Reputation: 61
I want to replace the string . I have used the following code to do that.
str_replace("\","/",$abc);
But it is showing error. please let me know what to do
Upvotes: 0
Views: 53
Reputation: 876
I don't know if this holds with PHP, but with most languages, \"
is an escape character - the quote won't end the string, it'll be considered part of the string.
If your trying to replace all \
with /
, then the code would look something like this:
str_replace("\\", "/", $abc);
Upvotes: 2
Reputation:
You need to escape your backslash:
str_replace("\\","/",$abc);
From the documentation:
To specify a literal backslash, double it (
\\
).
Upvotes: 0