Reputation: 151
I have a string containing '\' in it but when i replaced the string with blank it showing error.
$emailbody = str_replace('\','',$emailbody);
Thank you all
Upvotes: 0
Views: 2149
Reputation: 7294
Try stripslashes
for this
$emailbody = "hello \ its a testing\ string";
echo $emailbody = stripslashes($emailbody);
Note that stripslashes
only remove backslashes
not forward
Or
echo $emailbody = str_replace("\\","",$emailbody);
Output
hello its a testing string
Upvotes: 1