stripslashes

string stripslashes(string string) 

Strips backslashes from a string.

Returns:

String

Description:

stripslashes() removes the backslashes from any escape sequence that it encounters in a string. An escape sequence starts with a backslash and is followed by one or more characters.

This function is often used to strip backslashes from data retrieved from a database or to clean up data submitted by an HTML form.

Version:

PHP 3+, PHP 4+

See also:

To remove backslashes and convert C-style escape sequences to their literal values:

stripcslashes() 

To add slashes to a string:

addslashes() 

Example:

Remove slashes from data retrieved from a database
 // database connection code omitted for brevity $author = 'Sam Clemens'; // query a ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.