PHP addslashes() function is used to add backslashes before the characters that need to be escaped. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).
Syntax
string addslashes(str);
Parameter | Description |
---|---|
str : | Required parameter. The string to be escaped. |
Return Value : | Returns the escaped string. |
<?php echo addslashes("Who Tom's Hero?"); echo addslashes('What does "honey" mean?'); ?>