STRIP CURRENT URL OF ARBITRARY FOLDERS AND NAME ANCHOR


/ Published in: PHP
Save to your folder(s)

Useful for comparing file path when developing on different test sites, leaves just file name, also strips named anchors from end


Copy this code and paste it in your HTML
  1. // REPLACE FOLDERS WITH NOTHING
  2. // str_replace(find_this, replace_with_this, string_to_search );
  3. // This strips folder names from the path
  4. $me = str_replace("/acme/project/090331/", "", $_SERVER["REQUEST_URI"] );
  5. //$me = ereg_replace ( find_this, replace_with_this, string_to_search );
  6. // This strips #anything from end of url
  7. $me = ereg_replace ( "#(.*)", "", $me );

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.