Home >Backend Development >PHP Tutorial >preg_match_all 性能低.效率差.有其它办法吗?该如何解决

preg_match_all 性能低.效率差.有其它办法吗?该如何解决

WBOY
WBOYOriginal
2016-06-13 11:47:481229browse

preg_match_all 性能低.效率差.有其它办法吗???
原来用preg_replace_callback发现效率低.
改成preg_match_all  + str_replace
str_replace几乎不花时间. preg_match_all执行一次要花0.5秒以上.
------解决方案--------------------
那肯定是正则匹配花的时间长,贴出代码瞧瞧。

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