The addslashes function adds a backslash in front of the special characters ', ", \, and null in a string.

    
    $sentence = 'What's another word for "synonym"?';

    $sentenceAddSlashes = addslashes($sentence);

    echo $sentenceAddSlashes;
    // What\'s another word for \"synonym\"?