Home > Backend Development > PHP Tutorial > preg_replace改为preg_replace_callback

preg_replace改为preg_replace_callback

WBOY
Release: 2016-06-13 12:25:48
Original
1035 people have browsed it

preg_replace改成preg_replace_callback
preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $value);
正则不怎么懂
------解决思路----------------------
preg_replace_callback('!s:(\d+):"(.*?)";!s', function($m) { return 's:'.strlen($m[2]).":\"$m[2]\";";}, $value);

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