refiking Posted November 22, 2009 Share Posted November 22, 2009 I am trying to remove all of the backslashes from a variable, but it's just not working. here is what I have: $new = str_replace('\', '', $original); echo $new; Link to comment https://forums.phpfreaks.com/topic/182527-help-with-str_replace/ Share on other sites More sharing options...
smerny Posted November 22, 2009 Share Posted November 22, 2009 try putting '\\' Link to comment https://forums.phpfreaks.com/topic/182527-help-with-str_replace/#findComment-963391 Share on other sites More sharing options...
salathe Posted November 22, 2009 Share Posted November 22, 2009 Backslash is a special character in PHP strings, see http://php.net/types.string#language.types.string.syntax.single In your case, you would need: $new = str_replace('\\', '', $original); echo $new; Link to comment https://forums.phpfreaks.com/topic/182527-help-with-str_replace/#findComment-963392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.