how to replace quotation marks with \”

As comments and other answers indicate your question may not be quite explicit enough. Taking it at face value, if you just want to replace double quotes (") you should use str_replace()

str_replace('"', '\"', $string);

Leave a Comment