时间:2021-07-01 10:21:17 帮助过:55人阅读
$s = '我是一个人TKPC11090987是你TKPC10090987吗?TKPC10098M9Y到底是谁呢?TKMR120990U9TKMR10059E56TKMR10059E56..';$d = array( 'TKPC' => '11069', 'TKMR' => '10999',);echo preg_replace_callback('/(TKPC|TKMR)(\d{5}).{3}/', function($m) use ($d) { if($m[2] <= $d[$m[1]]) return "$m[0]"; return $m[0]; }, $s);我是一个人TKPC11090987是你TKPC10090987吗?TKPC10098M9Y到底是谁呢?TKMR120990U9TKMR10059E56TKMR10059E56..