<?
$txt = array();
$txt[0] = "xxxxxx id_1 xxccxx";
$txt[1] = "xxxx id_6 xxxxxx";
$txt[2] = "xxxxx id_9 xxxxxxxxx";
$txt[3] = "xxxxxxxid_4xxxxx";
$txt[4] = "adfasfasdf id_12xxxxx";
$reg = "/id\_(\d)/i";
preg_match_all($reg,implode(",",$txt),$matches);
print(array_sum($matches[1]));
?>
$txt = array();
$txt[0] = "xxxxxx id_1 xxccxx";
$txt[1] = "xxxx id_6 xxxxxx";
$txt[2] = "xxxxx id_9 xxxxxxxxx";
$txt[3] = "xxxxxxxid_4xxxxx";
$txt[4] = "adfasfasdf id_12xxxxx";
$reg = "/id\_(\d)/i";
preg_match_all($reg,implode(",",$txt),$matches);
print(array_sum($matches[1]));
?>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货