Addcslashes

Support PHP4, PHP5

addcslashes - C-style slash string

Description

php
string addcslashes (string $str, string $charlist)

Returns a string with backslashes before the characters that are specified in the charlist parameter.

Parameters

str Text string

charlist

characters to be removed. If charlist contains the characters \n, \r, and others, they are converted to C-style. Other non-alphanumeric ASCI characters with lengths less than 32 and greater than 126 change.

When you define a sequence of characters in a charlist argument, make sure you know what characters you put as the beginning and end of the range.

php
echo addcslashes('foo[ ]', 'a..z');
// Values.
// Removes all upper and lower case letters

Return values

Returns the modified string.

Example

php
$escaped = addcslashes($not_escaped, "\0..\37!@\177..\377");

charlist \0..\37!@\177..\377, removes all characters with ASCII code between 0 and 31.

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.