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).
Example
<?php
$str = addslashes('What does "hello" mean?');
echo($str);
?>
Output
What does \"hello\" mean?