.


Divya

addcslashes() Function in PHP


In PHP the addcslashes() function is used to add backslashes in front of the specified characters.

NoteThe addcslashes() function is case-sensitive.

Syntax

addcslashes(string,characters)

Example

<!DOCTYPE html>
<html>
<body>
<?php
$str = "Welcome to students tutorial!";
echo $str."
";
echo addcslashes($str,'s')."
";
echo addcslashes($str,'t')."
";
?>
</body>
</html>
Output

Welcome to students tutorial!
Welcome to \student\s tutorial!
Welcome \to s\tuden\ts \tu\torial!



.