How to remove quotes in php

藏色散人
Release: 2023-03-01 20:54:02
Original
3744 people have browsed it

How to remove quotation marks in php: First create a PHP sample code file; then use the "str_replace()" function to replace the quotation marks ["]. The code statement is "".

How to remove quotes in php

##php remove quotation marks

<?php $s=str_replace(&#39;"&#39;,&#39;&#39;, $str); ?>
Copy after login

Use str_replace() function

Replace the words containing double quotes "

Another example should be easy to understand at a glance:

<?php echo $s=str_replace("one","two", "hello one"); ?>
Copy after login

This output is hello two

str_replace() Function introduction:

str_replace() function replaces some characters in the string (case sensitive).

This function must follow the following rules:

If you search The string is an array, then it will return an array.

If the searched string is an array, then it will find and replace each element in the array.

If an array needs to be searched and replaced at the same time, and the elements that need to be replaced are less than the number of found elements, the excess elements will be replaced with empty strings.

If it is an array Search, but only replace a string, then the replacement string will work on all found values.

Note: This function is case-sensitive. Please use the str_ireplace() function to perform Case-sensitive search.

Note: This function is binary safe.

Syntax

str_replace(find,replace,string,count)
Copy after login

Parameters

find Required. Specifies the value to find .

replace required. Specifies the value to replace the value in find.

string required. Specifies the string to be searched.

count Optional. A variable, for replacement Count numbers.

Recommended: "

PHP Tutorial"

The above is the detailed content of How to remove quotes in php. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!