9.3.8 字符串中正则的其它函数

9.3.8 字符串中正则的其它函数

test.php

";


    $reg = "/(\d{4})(-\d{2}-\d{2})/";

    function myfun($m) {
        return ($m[1]+1).$m[2];
    }

    echo preg_replace_callback($reg, "myfun", $text);

demo.php

你可能感兴趣的:(9.3.8 字符串中正则的其它函数)