How to use addslashes in PHP

In this article, I will explain how the addslashes() function can be used in PHP.
  • 1247

addslashes() function in PHP

  • The addslashes() function is used to return a string with backslashes in front of the characters that need to be quoted.
  • In PHP predefine charater are
    • single quote (').
    • double quote (").
    • backslash (\).
    • NULL.

Syntax

addslashes(string)

Parameter

  • string string is required parameter. the string is determine check to string.

Example

The following example show to how the addslashes() function can be used in PHP.

<html>

<body>

<h3 style="color: blue;">addslashes() function example in PHP</h3>

   <?php

    echo addslashes("Wlcome to");

    echo '<br>';

    echo addslashes('"C-sharpcorner....');

    ?>

</body>

</html>

 

Output

addslashesphp.jpg
You may also want to read these related articles here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.