rtrim a URL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dimxasnewfrozen
Forum Commoner
Posts: 84
Joined: Fri Oct 30, 2009 1:21 pm

rtrim a URL

Post by dimxasnewfrozen »

I have a url like:
"http://www.example.com/mem.php?myInquir ... h=47423628#"

I need to get the actual page URL without the options at the end:
"http://www.example.com/mem.php"

I'm just looking to use a simple rtrim but I'm not sure how to format it.
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: rtrim a URL

Post by cpetercarter »

Code: Select all

$bits = explode("?", $url);
$trimmed_url = $bits[0];
Post Reply