Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    May 2008
    Posts
    446
    Thanks
    23
    Thanked 5 Times in 5 Posts

    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

  • #2
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    PHP Code:
    $uri trim$_SERVER['REQUEST_URI'], '/' ); 

  • #3
    Regular Coder
    Join Date
    May 2008
    Posts
    446
    Thanks
    23
    Thanked 5 Times in 5 Posts
    absolutely fantastic! I thought trim() was only good for getting rid of blank spaces around the string.

    Thanks a lot!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •