addcslashes

Syntax: string addcslashes ( string $str , string $charlist )

Description: Returns a string with backslashes before characters that are listed in charlist parameter.A list of characters to be escaped.

Example 1

<?php
$str="hai...i like india";
echo 'Input String :'.$str;
echo '<br/>';
echo 'Output String (addcslashes($str,"i")) : '.addcslashes($str,'i');
echo '<br/>';
?>

OUTPUT

Input String :hai...i like india
Output String (addcslashes($str,"i")) : ha\i...\i l\ike \ind\ia

Example 2

<?php
$str="Hai Welcome Hai Hai";
echo 'Input String :'.$str;
echo '<br/>';
echo 'Output String (addcslashes($str,"eai")) : '.addcslashes($str,'eai');
echo '<br/>';
?>

OUTPUT

Input String :Hai Welcome Hai Hai
Output String (addcslashes($str,"eai")) : H\a\i W\elcom\e H\a\i H\a\i

Example 3

<?php
$str="Hai Welcome Hai Hai";
echo 'Input String :'.$str;
echo '<br/>';
echo 'Output String (addcslashes($str,"A..Z")) : '.addcslashes($str,'A..Z');
echo '<br/>';
echo 'Output String (addcslashes($str,"a..z")) : '.addcslashes($str,'a..z');
echo '<br/>';
?>

OUTPUT

Input String :Hai Welcome Hai Hai
Output String (addcslashes($str,"A..Z")) : \Hai \Welcome \Hai \Hai
Output String (addcslashes($str,"a..z")) : H\a\i W\e\l\c\o\m\e H\a\i H\a\i