Addslashes
from PHPWiki - the free guide to PHP.
[edit] Description
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.
[edit] Parameters
| string addslashes (string input) |
[edit] Parameter Infos
| Parameter | PHP Version | Type |
| addslashes | 4 or 5 | returns string |
| input | 4 or 5 | string |
[edit] Examples
[edit] Example 1:
<?php
echo addslashes("Is your name O'reilly?");
?>
[edit] Output
Is your name O\'reilly?
[edit] See also
stripslashes, addcslashes, stripcslashes, htmlspecialchars, get_magic_quotes_gpc, quotemeta
- For more details on this function, visit its entry in the php manual.
