Loading...
PHP

Slashes in PHP

  1. addslashes: To add black slashes infront of single and double quotations.
  2. stripslashes: This is used to remove the back slashes infront of single and double quotations.
    <?php
    $str=”wel’come”;
    $str1=$str;
    echo addslashes($str1);
    echo stripslashes($str1);
    ?>
  3. addcslashes: To add escape slash “\” infront of specified characters.
  4. stripcslashes: To remove slashes.
    <?php
    $str=”welcome”;
    $str1=addcslashes($str,”e”);
    echo $str1;
    echo stripcslashes($str1);
    ?>
Leave a Reply

Your email address will not be published. Required fields are marked *