addslashes

addslashes

(PHP 4, PHP 5, PHP 7)

addslashesQuote string with slashes

Description

string addslashes ( string $str )

Returns a string with backslashes before characters that need to be escaped. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).

An example use of addslashes() is when you're entering data into string that is evaluated by PHP. For example, O'Reilly is stored in $str, you need to escape $str. (e.g. eval("echo '".addslashes($str)."';")