Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

addcslashes(3) [php man page]

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 "..37", which would escape all characters with ASCII code between 0 and 31. Example #1 addcslashes(3) example <?php $escaped = addcslashes($not_escaped, "..37!@177..377"); ?> SEE ALSO
stripcslashes(3), stripslashes(3), addslashes(3), htmlspecialchars(3), quotemeta(3). PHP Documentation Group ADDCSLASHES(3)

Check Out this Related Man Page

HTMLSPECIALCHARS_DECODE(3)						 1						HTMLSPECIALCHARS_DECODE(3)

htmlspecialchars_decode - Convert special HTML entities back to characters

SYNOPSIS
string htmlspecialchars_decode (string $string, [int $flags = ENT_COMPAT | ENT_HTML401]) DESCRIPTION
This function is the opposite of htmlspecialchars(3). It converts special HTML entities back to characters. The converted entities are: &amp;, &quot; (when ENT_NOQUOTES is not set), &#039; (when ENT_QUOTES is set), &lt; and &gt;. PARAMETERS
o $string - The string to decode. o $flags - A bitmask of one or more of the following flags, which specify how to handle quotes and which document type to use. The default is ENT_COMPAT | ENT_HTML401. Available $flags constants +--------------+---------------------------------------------------+ |Constant Name | | | | | | | Description | | | | +--------------+---------------------------------------------------+ | | | | ENT_COMPAT | | | | | | | Will convert double-quotes and leave single- | | | quotes alone. | | | | | | | | ENT_QUOTES | | | | | | | Will convert both double and single quotes. | | | | | | | |ENT_NOQUOTES | | | | | | | Will leave both double and single quotes uncon- | | | verted. | | | | | | | | ENT_HTML401 | | | | | | | Handle code as HTML 4.01. | | | | | | | | ENT_XML1 | | | | | | | Handle code as XML 1. | | | | | | | | ENT_XHTML | | | | | | | Handle code as XHTML. | | | | | | | | ENT_HTML5 | | | | | | | Handle code as HTML 5. | | | | +--------------+---------------------------------------------------+ RETURN VALUES
Returns the decoded string. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.4.0 | | | | | | | The constants ENT_HTML401, ENT_XML1, ENT_XHTML | | | and ENT_HTML5 were added. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 A htmlspecialchars_decode(3) example <?php $str = "<p>this -&gt; &quot;</p> "; echo htmlspecialchars_decode($str); // note that here the quotes aren't converted echo htmlspecialchars_decode($str, ENT_NOQUOTES); ?> The above example will output: <p>this -> "</p> <p>this -> &quot;</p> SEE ALSO
htmlspecialchars(3), html_entity_decode(3), get_html_translation_table(3). PHP Documentation Group HTMLSPECIALCHARS_DECODE(3)
Man Page