SQL PHP HTML ASP JavaScript articles and free scripts to download
PHP String Functions

addcslashes string function

We can add slashes in c type by using addcshashes function . Here is the syntax
string addcslashes(string,string or charlist)
Here are some examples
$string="Hello welcome to plus2net Php section";
echo addcslashes($string,'e');
Output of this is here
H\ello w\elcom\e to plus2n\et Php s\ection 
Note in all places char e is escaped by adding a slashes

Escaping more than one char

$string="Hello welcome to plus2net Php section";
echo addcslashes($string,'c,o,n');
Output is here
Hell\o wel\c\ome t\o plus2\net Php se\cti\o\n 

For a series of chars

$string="Hello welcome to plus2net Php section";
echo addcslashes($string,'a..z');
Output is here
H\e\l\l\o \w\e\l\c\o\m\e \t\o \p\l\u\s2\n\e\t P\h\p \s\e\c\t\i\o\n 
Note that all upper case chars are not escaped

Be the first to post comment on this article :

Post Comment This is for short comments only. Use the forum for more discussions.
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2015 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer