I have a string variable that consists of a url. Basically it is “http://www.anydomain.com/anypage.htm” The domain will be varied in length and the amount of “/”'s will vary as well.
So the string could be any of the folowing:
http://www.anydomain.com/anypage.htm
http://www.any.com/anypage.htm
http://www.anydomain.com/page.htm
http://www.anydomain.com/sub/sub/page.htm
What I need to do is strip out everything except the stuff after the last “/” … basically leaving me with the page name.
Is preg_replace the easiest way to do this?
If so, what would the code look like… preg_replace looks pretty compliacated.
Thanks?