In PHP, you can use the stripslashes() function to reverse-escape the string. This function can restore the escaped string and delete the backslash added by the addslashes() function. The syntax format is " stripslashes(string)"; this function returns the raw, unescaped string.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
php string reverse Escape
You can use the stripslashes() function, which can restore the escaped string and delete the backslashes added by the addslashes() function.
Syntax format:
stripslashes(string)
This function returns the original string without escaping, and the parameterstring
is the escaped string.
The example of restoring the escaped string is as follows:
"; echo stripslashes($str1) . "
"; ?>
The execution result of the above program is:
I don\'t love you I don't love you
Recommended learning: "PHP Video tutorial》
The above is the detailed content of How to unescape strings in php. For more information, please follow other related articles on the PHP Chinese website!