Function to split and cut the string and print in PHP

unlockboxthis

New Member
I want to know the function that can perform the following operation$str = "uploads/file/file1.jpg";i want to slash the initial of the string uploads/file/ and just want to return file1.jpg as value. i tried using str_replace(), \[code\]$str = "uploads/file/file1.jpg";$str2 = str_replace("uploads/file"," ", $str);echo $str;\[/code\]this is not working, where i am going wrong?EDIT : Silly me i was not noticing that i was trying to echo $str, sorry for this. it is working for me now.BTW i want to know which method is better the above one or the basename();
 
Back
Top