The addslashes() function is used to add backslashes in front of the characters that need to be quoted. The predefined characters are single quote (‘), double quote(“), backslash(\) and NULL (the NULL byte).
<?php $str = addslashes('What does "hello" mean?'); echo($str); ?>
What does \"hello\" mean?