Description Edit

addslashes will return a string with certain characters quoted. The characters that get an backslash are single quote ('), double quote ("), backslash (\) and NUL. So (') becomes (\'), (") becomes (\") and (\) becomes (\\).

Note: If the PHP directive magic_quotes_gpc is on you should not use addslashes. This way you would have your strings double quoted.

Parameters Edit

{{{returns}}} addslashes (string input)

Parameter Infos Edit

Parameter PHP Version Type
addslashes 4 or 5 returns string
input 4 or 5 string

Examples Edit

Example 1: Edit

 echo addslashes("Is your name O'reilly?");

Output Edit

Is your name O\'reilly?

See also Edit

stripslashes, addcslashes, stripcslashes, htmlspecialchars, get_magic_quotes_gpc, quotemeta

For more details on this function, visit its entry in the php manual.