Home >Backend Development >PHP Tutorial >PHP message matching

PHP message matching

WBOY
WBOYOriginal
2016-08-04 09:19:431049browse

There is an information template, such as:
"Name: @, phone number @, please notify this person"
The @ is a variable that needs to be modified, fill in the information, and become

<code>"姓名:小明,电话:15888888888,请通知此人"
</code>

How can I tell whether the modified template uses the previous template?

Reply content:

There is an information template, such as:
"Name: @, phone number @, please notify this person"
The @ is a variable that needs to be modified, fill in the information, and become

<code>"姓名:小明,电话:15888888888,请通知此人"
</code>

How can I tell whether the modified template uses the previous template?

Regular replacement preg_replace :xxx, Replace with:@,

<code>$a = "姓名:小明,电话:15888888888,请通知此人";
var_dump(preg_replace('/:([^<]*?),/is',':@,',$a));</code>

Then compare it with your message template.

Statement:
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