PHP addcslashes() Function

PHP addcslashes() function is used to add backslashes before the specified characters.

Syntax

string addcslashes(str,charlist);

addcslashes() Function Parameter

ParameterDescription
str :Required parameter. The string to be escaped.
charlist :Required parameter. A list of characters to be escaped.

addcslashes() Function Return Value

Return Value :Returns the escaped string.

addcslashes() Function Example 1

<?php
echo(addcslashes("Returns the escaped string","t"));
?>

addcslashes() Function Example 2

<?php
echo(addcslashes("Returns the escaped string",'A..Z'));
?>

addcslashes() Function Example 3

<?php
echo(addcslashes("Returns the escaped string",'a..z'));
?>