This function returns a string with backslashes added before certain characters.
Syntax: addcslashes(string,characters);
characters – the characters before which a backslash is to be added.
Example inputs:
1.
$str1=" my program";
echo $str1;
echo "
";
echo addcslashes($str1,"r");
echo "
";
echo addcslashes($str1,"r,m");
2.
$str1=" my program";
echo $str1;
echo "
";
echo addcslashes($str1,"a...p");
In this case, a backslash is added before every character that falls between a and p in the alphabetical sequence.
3.
$str1=" 121232342434";
echo $str1;
echo "
";
echo addcslashes($str1,"1...3");
Example outputs:
1.
my program my p\rog\ram \my p\rog\ra\m
2.
my program \my \pr\o\gr\a\m
3.
121232342434 \1\2\1\2\3\2\34\24\34
No comments:
Post a Comment