PHP :: addcslashes String function

String Ref

The PHP addcslash function will returns a string with backslash in-front of the specified characters.

addcslash Examples

<?php
      $data = "Welcome to PHP Tutorial Website";
      echo addcslash($data,'W')."<br />";
      echo addcslash($data,'e')."<br />";
?>

Output:

\Welcome to PHP Tutorial \Website
W\elcom\e to PHP Tutorial Websit\e
<?php
      $data = "Welcome to PHP Tutorial Website";
      echo addcslash($data,'a..z')."<br />
";
      echo addcslash($data,'A..Z')."<br />
";
?>

Output:

W\e\l\c\o\m \t\o PHP T\u\t\o\r\i\a\l W\e\b\s\i\t\e
\Welcome to \P\H\P \Tutorial \Website
Note: Be careful if you choose to escape characters 0, a, b, f, n, r, t and v. 
They will be converted to \0, \a, \b, \f, \n, \r, \t and \v, all of which are predefined escape sequences in PHP.