I am trying to find a way to automatically escape (\) all quotation marks in a string with many quotation marks. I think, in ASP there is an object that takes care of all this tedious work for you, but is there something similar in PHP?
I was thinking of using addslashes(), but it's not as easy as it sounds. I have the following string to echo, how can I do it without manually adding backslashes in front of all (") and (') ?
Before:
"<a href=" src="{$row['link']}"></a>"
After:
"<a href=\" src=\"{$row['link']}\"></a>
I was thinking of using addslashes(), but it's not as easy as it sounds. I have the following string to echo, how can I do it without manually adding backslashes in front of all (") and (') ?
Before:
"<a href=" src="{$row['link']}"></a>"
After:
"<a href=\" src=\"{$row['link']}\"></a>