Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-05-2012, 01:28 AM   PM User | #1
surreal5335
Regular Coder

 
Join Date: May 2008
Posts: 446
Thanks: 23
Thanked 5 Times in 5 Posts
surreal5335 is an unknown quantity at this point
parse url based on forward slashes

I need to parse a url using substr() or something similar based on its forward slashes.

In the end it will go from:
http://domain.com/mypage/one/

to dropping:
http://domain.com/

and leave only
mypage/one

notice The lack of the closing forward slash at the end of the original url. I appreciate any help in the matter
surreal5335 is offline   Reply With Quote
Old 01-05-2012, 03:12 AM   PM User | #2
kbluhm
Senior Coder

 
kbluhm's Avatar
 
Join Date: Apr 2007
Location: Philadelphia, PA, USA
Posts: 1,502
Thanks: 2
Thanked 258 Times in 254 Posts
kbluhm will become famous soon enough
PHP Code:
$uri trim$_SERVER['REQUEST_URI'], '/' ); 
__________________
ZCE
kbluhm is offline   Reply With Quote
Old 01-05-2012, 03:12 PM   PM User | #3
surreal5335
Regular Coder

 
Join Date: May 2008
Posts: 446
Thanks: 23
Thanked 5 Times in 5 Posts
surreal5335 is an unknown quantity at this point
absolutely fantastic! I thought trim() was only good for getting rid of blank spaces around the string.

Thanks a lot!
surreal5335 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:28 AM.


Advertisement
Log in to turn off these ads.