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? Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
unidox Posted May 10, 2008 Author Share Posted May 10, 2008 Nope, it says syntax error, unexpected " Quote Link to comment 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); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.