Fandom

PHP Wiki

Addslashes

51pages on
this wiki
Add New Page
Talk0 Share

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

<?php
 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.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.