ADDCSLASHES(3) 1 ADDCSLASHES(3)
addcslashes - Quote string with slashes in a C style
SYNOPSIS
string addcslashes (string $str, string $charlist)
DESCRIPTION
Returns a string with backslashes before characters that are listed in $charlist parameter.
PARAMETERS
o $str
- The string to be escaped.
o $charlist
- A list of characters to be escaped. If $charlist contains characters
,
etc., they are converted in C-like style, while
other non-alphanumeric characters with ASCII codes lower than 32 and higher than 126 converted to octal representation. When you
define a sequence of characters in the charlist argument make sure that you know what characters come between the characters that
you set as the start and end of the range.
<?php
echo addcslashes('foo[ ]', 'A..z');
// output: foo[ ]
// All upper and lower-case letters will be escaped
// ... but so will the []^_`
?>
<?php
echo addcslashes("zoo['.']", 'z..A');
// output: zoo['.']
?>
RETURN VALUES
Returns the escaped string.
CHANGELOG
+--------+---------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------+
| 5.2.5 | |
| | |
| | The escape sequences v and f were added. |
| | |
+--------+---------------------------------------------+
EXAMPLES
$charlist like "