Home > Article > Backend Development > How to remove backslash in php string
In PHP, you can use the stripslashes() function to remove the backslashes in the string. This function is used for anti-escaping. It can remove the backslashes in the string and return a stripped backslash. String after backslash; syntax "stripslashes(string)".
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
In PHP, you can use stripslashes () function to remove backslashes from strings.
The stripslashes() function returns a string with escaped backslashes stripped.
Example:
<?php header("Content-type:text/html;charset=utf-8"); $str = "欢迎来到\'PHP中文网\'"; $newstr = stripslashes($str); echo $str."<br>"; echo $newstr; ?>
Description:
stripslashes() function deletes the strips added by addslashes() function Backslash. (The addslashes() function is to add \
to the string and escape the specified string)
Syntax:
stripslashes(string)
Return value: Returns a string with backslashes stripped.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to remove backslash in php string. For more information, please follow other related articles on the PHP Chinese website!