English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP String Character String Functions Manual
The addcslashes() function is used to escape characters in a string using C language style backslashes
string addcslashes ( string $str , string $charlist )
Returns a string that adds a backslash before each character that belongs to the parameter charlist list.
It returns the escaped string
Serial Number | Parameters and Descriptions |
---|---|
1 | str String to be escaped |
2 | charlist If charlist contains characters such as \n, \r, etc., they will be converted in C language style, while other non-alphanumeric characters and ASCII codes below 32 and above 126 All characters are converted to octal representation. |
Try the following example
<?php echo addcslashes("zoo['.']", 'z..A'); // Output: \zoo['\.'] ?>Test and See ‹/›
Output Result:
\zoo['\.']