The addslashes Function
The addslashes function escapes some
characters in a string with a backslash.
The single quote ', double
quote ", backslash \ and NUL are escaped.
Syntax
addslashes(string $string): string
Example
Let's escape quotes using our function:
<?php
echo addslashes('id="eee"');
?>
Code execution result:
'id=\"eee\"'
See Also
-
the
stripslashesfunction,
which performs the reverse operation