English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP String Character String Functions Manual
The addslashes() function is used to quote strings.
string addslashes ( string $str )
Returns a string with backslashes added before certain characters for the need of database query statements, etc. These characters are single quotes ('), double quotes (\
PHP 5.4 Before PHP instruction magic_quotes_gpc is set to on by default, actually all GET, POST, and COOKIE data are escaped with addslashes(). Do not use addslashes() on strings that have already been escaped by magic_quotes_gpc, as this will cause double escaping. In such cases, you can use the function get_magic_quotes_gpc() to check.
It returns the escaped string
Serial Number | Parameter and Description |
---|---|
1 | str String to be escaped |
Try the following example
<?php $str = "Is your name sai Right?"; echo addslashes($str); ?>