Tag Archives: Php addcslashes function example

Php addcslashes example


Php addcslashes example : The string function addcslashes adds backslash before the specified character.


Php addcslashes example Syntax

$string = addcslashes("Tutorialsplane is the Best.","B");
echo $string;

Try it »

We have a string “Tutorialsplane is the Best” in which we will test the function addcslashes. We want to add backslash before the “B” character ie before the “\B”. Which will produce the new string with backslash as
“Tutorialsplane is the \Best.”.
Output : The above example will add backslash before the word “Best” ie \Best. The Output of the above example will
be-

Php addcslashes example

Php addcslashes function example