Get the App
SLTechnology News&Howtos  ›  Development  › 

How to replace double quotes with single quotes by php

Shulou Source: shulou.com Published: 2022-05-31 18:39:40 10月05日 Update

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:

Tags: Quotation marks characters strings functions methods rules expressions learning more examples grammar help practical next tutorials articles environment theory computer knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Huawei NVidia vpn OPPO Reno