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
    New Coder
    Join Date
    Sep 2011
    Posts
    69
    Thanks
    6
    Thanked 0 Times in 0 Posts

    remove all strings before '/'

    Hi,

    My one (1) varriable $string is return string like this 'fishes_photos/item_thumb_photo_9252Winter.jpg'


    I need to remove all strings before '/' and also remove '/' like this 'item_thumb_photo_9252Winter.jpg'

    I used str_replace() but unable to achieve my need please help me

    Regards.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,853
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    PHP Code:
    $arr=explode($string,',');
    echo 
    end($arr); 
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    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:
    $file_name basename$string );

    echo 
    $file_name// item_thumb_photo_9252Winter.jpg 


  •  

    Posting Permissions

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