How to replace \"
with "
from a string in php and to remove \
from end of a string?
My line of code is like :
$field[] = str_replace('\\"', '"', trim($val, '\\'));
But this is not working..somebody please help me
How to replace \"
with "
from a string in php and to remove \
from end of a string?
My line of code is like :
$field[] = str_replace('\\"', '"', trim($val, '\\'));
But this is not working..somebody please help me
You can do it with default function - stripslashes:
$val = '"hell\"ooo\\';
echo stripslashes($val);
Or if you need with str_replace:
$val = '"hell\"ooo\\';
echo str_replace('\\"', '"', trim($val, '\\'));
Result would be:
"hell"ooo