addcslashes() function in PHP

By | December 24, 2013

It Resturns a string with backslashes infront of the characters.

this function is case-sensitive


Syntax
——

addcslashes(string,characters)

Both parameters are required fields.
string-this is the String to be escaped
characters-this is the characters/range of character to be escaped

Example
——-

$mystring=”Welcome to mydoubts”;
echo addcslashes($mystring,’m’);

Above statement will print the output as below

Welco\me to \mydoubts

note: you can escape multiple characters using a..z in the above function you can use instead of m put a..z.