addcslashes() function in PHP || PHP addcslashes function
×


addcslashes() function in php

1813

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.

Syntax:

addcslashes($string,$characters);

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.

Example:

<?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";
?>

Output:



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments