stripslashes – PHP String Functions

Syntax :

string stripslashes ( string);

Description :

It’s an inbuilt function of PHP. stripslashes() function un-quote string quoted with addslashes().

Note : We can use this function to clean up data fetched fom a database or data which is submitted by an HTML form.

Parameter :

  • string – This is a Required parameter. The string to be unescaped.

Output :

Returns the unescaped string. Removes the backslashes from string.  (\’ becomes  and so on.) Double backslashes (\\) are made into a single backslash (\).

Note : stripslashes() is not recursive. If you want to apply this function to a multi-dimensional array, you need to use a recursive function.


Related articles : addslashes(), addcslashes().


stripslashes() – PHP Functions Example 1 :
<?php
echo stripslashes("Who\'s Charles?");
?>

Output of above code in the browser is as below:

Who’s Charles?

You may also like...

Leave a Reply

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