日期:2014-05-17 浏览次数:20543 次
$s = '0,48423,48425,48427,48419,48413,48415,48417,48418,48414,48416,48411,';
echo preg_replace('/\d+,((?:\d+,){3}\d+).*/', '$1', $s);
$string = "0,48423,48425,48427,48419,48413,48415,48417,48418,48414,48416,48411,";
$ar=explode(',',$string);
$arr=array_slice($ar,1,4);
echo join(',',$arr);
$str="0,48423,48425,48427,48419,48413,48415,48417,48418,48414,48416,48411,";
function jiequ($str,$a,$b){
$ar=explode(",",$str);
for($i=$a;$i<$b;$i++){
$br[]=$ar[$i];
}
return implode(",",$br);
}
echo jiequ($str,1,5);//1和5表示截取第一个,和第5个,之间的数