Page 1 of 1

string replace - str_replace

Posted: Thu Oct 02, 2008 4:30 pm
by baddis
How can I do a str_replace for "\" when I try "\" I get syntax error

$output = str_replace("\", "\", $stringData);

Re: string replace - str_replace

Posted: Thu Oct 02, 2008 6:34 pm
by VladSun
\ is used for escaping so you should escape the "escape char" :) like this:

$s= "\\"; // $s now is exactly \