Reputation: 309
I have something like this :
$x = "#frac {2} {3}";
I try this code but is doesnt work:
$x = str_replace("#","\"",$x);
I want to replace # with with \ in this string. But I cant use str_replace.
any help?
Upvotes: 0
Views: 94
Reputation: 2929
You are replacing the # with a "
To use the backslash in a string you need to escape it.
How do you make a string in PHP with a backslash in it?
$x = "#frac {2} {3}";
$x = str_replace("#", "\\", $x);
Upvotes: 1