stripslashes()
stripslashes() — Un-quotes a quoted string.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
stripslashes() can be used if you aren't inserting this data into a place (such as a database) that requires escaping. For example, if you're simply outputting data straight from an HTML form.
Signature
stripslashes(string $string): string
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $string | string | The input string. |
Return value
Returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\\) are made into a single backslash (\).
Example
A runnable snippet:
$str = "Is your name O\'reilly?"; // Outputs: Is your name O'reilly? echo stripslashes($str);
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page stripslashes() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.