Home >Backend Development >PHP Problem >How to remove backslash in php string

How to remove backslash in php string

青灯夜游
青灯夜游Original
2022-02-10 14:00:534451browse

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)".

How to remove backslash in php 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 = "欢迎来到\&#39;PHP中文网\&#39;";
$newstr = stripslashes($str);
echo $str."<br>";
echo $newstr;
?>

How to remove backslash in php string

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn