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

How to remove backslash in php string

青灯夜游
Release: 2023-03-15 08:32:01
Original
4513 people have browsed it

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;
?>
Copy after login

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)
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template