unidox Posted May 10, 2008 Share Posted May 10, 2008 I am trying to find all \ in a string, and remove it. I have this code: $string = str_replace("\", "", $string); but the \ nulls the trailing " how do I do this? Link to comment https://forums.phpfreaks.com/topic/105035-solved-help/ Share on other sites More sharing options...
ILYAS415 Posted May 10, 2008 Share Posted May 10, 2008 try using this... $string= str_replace("\", "", $string); $string= strip_slashes($string); should work Link to comment https://forums.phpfreaks.com/topic/105035-solved-help/#findComment-537637 Share on other sites More sharing options...
unidox Posted May 10, 2008 Author Share Posted May 10, 2008 Nope, it says syntax error, unexpected " Link to comment https://forums.phpfreaks.com/topic/105035-solved-help/#findComment-537639 Share on other sites More sharing options...
BlueSkyIS Posted May 10, 2008 Share Posted May 10, 2008 either escape the slash with another slash, or use single quotes instead: $string = str_replace('\', "", $string); Link to comment https://forums.phpfreaks.com/topic/105035-solved-help/#findComment-537654 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.