How to replace double quotes with single quotes by php
This article mainly introduces "how php replaces double quotes with single quotes". In daily operation, I believe many people have doubts about how to replace double quotes with single quotes in php. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts of "how php replaces double quotes with single quotes". Next, please follow the editor to study!
Replacement method: 1, use preg_replace () function with regular expression "/\" / ", syntax" preg_replace ('/\ "/'," string) "; 2, use str_replace () function, syntax" str_replace ('",", string)".
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
The method of php replacing double quotation marks with single quotation marks
Method 1: use preg_replace () function with regular expression to change double quotation marks into single quotation marks.
The preg_replace function performs the search and replacement of a regular expression.
The regular expression used is: /\ "/
Example: