<?php
header('content-type:text/html;charset=utf-8');
$str='331612_1,331495_1,331461_1,331559_1,333080_1,333555_1,331448_1,331618_1,333388_1,333408_1,327937_1,331615_1,331499_1';
$str = explode(',',$str);
$sum=0;
foreach($str as $key=>$value){
$str =strpos($value, '_');
$a =substr($value,$str+1);
$sum +=$a;
}
print_r($sum);
php计算字符串中的数字之和
猜你喜欢
转载自blog.csdn.net/qq_41912774/article/details/84589913
今日推荐
周排行