add slash to string php code example
Example 1: addslashes php
$str = addslashes('What does "yolo" mean?');
echo($str);
Example 2: add slashes to string
str = str.replace(/'/g, "\\'");
Example 3: add slashes to string
<?php
$str = "O'Reilly?";
eval("echo '" . addslashes($str) . "';");
?>