How to replace php with Chinese double quotes: use the [preg_replace] function method, [${1}] uses the first reference in the first parameter, and the second parameter means to replace the first The content within English double quotes matched by a parameter's regular expression is placed in Chinese double quotes.
How to replace php with Chinese double quotes:
$a = '我"你'; echo $a,"<br/>"; $a = preg_replace("\"","\“",$a); echo $a;
Regularity of the first parameter of preg_replace, No. The second parameter is the replacement result, and the third parameter is the string to be replaced.
The first parameter'/"([^"]*)"/'
means matching double quotation marks appearing in pairs, ()
represents Quotation, [^"]*
represents the content within the quotation marks, which is a string of any length that does not contain ".
The second parameter'"${1 }"'
${1} uses the first reference in the first parameter, which is the content within double quotes, so the second parameter means to replace the first The content within the English double quotes matched by the regular expression of each parameter is placed in the Chinese double quotes.
Related learning recommendations:
The above is the detailed content of How to replace php with Chinese double quotes. For more information, please follow other related articles on the PHP Chinese website!