seran128 Posted November 28, 2006 Share Posted November 28, 2006 I have a feild in my table called path this shows the full path of a file like/home/jeffnort/public_html/site1/GarageSaleImages/de126f931451872c80680e72ca3ac4df.pngWhat I need is just theGarageSaleImages/de126f931451872c80680e72ca3ac4df.pngpartwhat can I use to trim /home/jeffnort/public_html/site1 Link to comment https://forums.phpfreaks.com/topic/28755-trim-value/ Share on other sites More sharing options...
joshi_v Posted November 29, 2006 Share Posted November 29, 2006 $test="/home/jeffnort/public_html/site1/GarageSaleImages/de126f931451872c80680e72ca3ac4df.png";$test=substring($test,1);#This will removes the first "/" in the string.$testarr=explode("/",$test);#Forming an array with the breaking character "/".$testarr=arrreverse($testarr)# This will reverse the array .$final_string=.'/'.$testarr[0].'/'.$testarr[1]; #this will form the fianl strign with last two fields of the array.RegardsJoshi. Link to comment https://forums.phpfreaks.com/topic/28755-trim-value/#findComment-131992 Share on other sites More sharing options...
fenway Posted November 29, 2006 Share Posted November 29, 2006 You can also run a replace() in mysql if you know that's a fixed strin. Link to comment https://forums.phpfreaks.com/topic/28755-trim-value/#findComment-132092 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.