In PHP, I'm hoping one can do this with preg_replace and a regex replace all '
with \'
and all "
with \"
and all /
with \/
.
So replace all characters that can break a string with their escape character counterparts.
In PHP, I'm hoping one can do this with preg_replace and a regex replace all '
with \'
and all "
with \"
and all /
with \/
.
So replace all characters that can break a string with their escape character counterparts.
Yes you can do that with preg_replace, but in your case I might suggest simply using str_replace()
or addslashes()
.