php后向引用如何带入到函数参数

WBOY
Release: 2016-06-13 12:18:44
Original
1214 people have browsed it

php后向引用怎么带入到函数参数

preg_replace('/{get_(\w+)}/',$arr[$1], $content);
Copy after login


$1为后向引用,我需要把匹配的 \w+ 作为参数,传入到自定义函数,或者作为数组的索引,该怎么实现呢
------解决思路----------------------
preg_replace('/{get_(\w+)}/e','$arr["$1"]', $content);

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