Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use addslashes() functionin php ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 134
    Comment on it

    What is addslashes() function ?

    The addslashes() function basically used to returns a string with backslashes before characters that need to be quoted in database queries.

    Mostly it is used for predefined characters, addslashes() function is very useful when we try to insert strings into a database.

    These predefined characters are:

    single quote (')

    double quote (")

    backslash ()

    You can take reference form below example

    <?php 
       $addstr = addslashes('Hi how are you "Mac"?');
       // here $addstr is a variable
        echo($addstr); // now call the The addslashes() function
    ?>  
    

    output will come following:

    Hi how are you \"Mac\"?

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: