addslashes
Escape strings using backslash
addslashes()
function returns a string that adds a backslash before the predefined characters.
The predefined characters are:
Tip: This function can be used to prepare strings for strings stored in the database and database query statements.
Note: By default, PHP automatically runs addslashes()
on all GET, POST, and COOKIE data. So you should not use addslashes()
for escaped strings, as this will result in double-layer escape. In this case, you can use the function get_magic_quotes_gpc() to detect it.
addslashes ( string )
parameter | describe |
---|---|
string | Required. Specifies the string to be escaped. |