The addcslashes() function is used to add backslashes in front of the specified characters in a string.
Note : In PHP \0 (NULL), \r (carriage return), \n (newline), \f (form feed), \v (vertical tab) and \t (tab) are predefined escape sequences.
Example
<?php
$str = addcslashes("Hello Alex!","W");
echo($str);
?>
Output
Hello \Alex!