addcslashes() function in php
PHP addcslashes() function is used to add backslashes in a string before the characters given by the user. It is an inbuilt function of PHP. This function returns a modified string.
Note: To add backslashes before some special predefined characters use addslashes() function.
- $string is the input string in which we want to add backslashes.
- $characters are the characters before them we want to add backslashes into the given input string.
<?php $string="Ram goes to his school every morning."; $caharacters="a,e"; $new_string=addcslashes($string,$caharacters); echo "Old string is : $string <br>"; echo "New string is :$new_string"; ?>
Waiting for your comments