How to replace one backslash with two?
This code doesn't work:
$msg = str_replace("\","\\",$msg);
PHP will two backslashes insert into database as one.
If is there one backslash it will return a parse error.
How to replace one backslash with two?
This code doesn't work:
$msg = str_replace("\","\\",$msg);
PHP will two backslashes insert into database as one.
If is there one backslash it will return a parse error.
How to replace one backslash with two?
This code doesn't work:$msg = str_replace("\","\\",$msg);
PHP will two backslashes insert into database as one.
If is there one backslash it will return a parse error.
change your double quotes " to single ticks '
Not working.
I still get the parse error.
$msg = str_replace('\','\\',$msg);
with this?
alternatively since you are escape your backslash you could use 4 \ on the second one.
also try
$msg = str_replace('\','\\\\',$msg);
I think that one will work. I'm drunk and no php here, but the 2nd should work
Not working.
When i put:
$msg = str_replace('anything','\\\\',$msg);
it works but when i put
$msg = str_replace('\','\\\\',$msg);
it doesn't work.
the first \ is an escape character. so put 2 of them.
\\
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.