Simple String Parising. Help!
Posted 30 June 2006 - 05:55 PM
I've tried parse_url, but the problem is that will give the host (www.somedomain.com) and path (/blahblah/blah/whatever.html).
So it is of no use here.
I'm sure I can do this just by somehow having PHP look for the last forward slash, "/" in the string and truncating after that. Can someone help me out witha bit of code that might do this?
Thanks in advance!
Posted 30 June 2006 - 06:03 PM
Posted 30 June 2006 - 06:33 PM
$url = 'http://www.somedomain.com/blah/blah/whatever.html' $url_arr = explode("/", $url) $page = array_pop($url_arr) $new_url = $implode("/",$url_arr)
edit: the code is very small to read . pasted:
$url = 'http://www.somedomai...h/whatever.html'
$url_arr = explode("/", $url)
$page = array_pop($url_arr)
$new_url = $implode("/",$url_arr)
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users