September 2001
Intermediate to advanced
768 pages
32h 45m
English
string addslashes(string string) Escapes all backslashes, null bytes, and single or double quotes in a given string.
Returns:
String with special characters escaped
Description:
addslashes() is usually used to prepare a string for storage in a database or some kind of delimited format such as comma-separated values (CSV). The function places a single backslash in front of any backslashes (\), quotes (" or '') or null (\0) bytes in the string argument. This prevents the contents of the string from accidentally “breaking” the quoting of whatever format the string is being stored in. See the first example for a practical demonstration of how this can happen.
Version:
PHP 3+, PHP 4+
See also:
To escape or unescape strings:
addcslashes() ...
Read now
Unlock full access