Home >Backend Development >PHP Tutorial >preg_replace轮换结果

preg_replace轮换结果

WBOY
WBOYOriginal
2016-06-13 10:36:37828browse

preg_replace替换结果
请问一下:

$a = '(abcd)';
echo preg_replace("/\((.*?)\)/s",strtoupper("\\1"),$str);

为什么输出的结果abcd不能变成大写呢?
谢谢!

------解决方案--------------------
echo preg_replace("/\((.*?)\)/es",'strtoupper("\\1")',$a);
------解决方案--------------------
echo preg_replace("/\((.*?)\)/es",'"".strtoupper("\\1").""',$a);

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