时间:2021-07-01 10:21:17 帮助过:1人阅读
$s = '1,2,3,7,8';
$ar = explode(',', $s);
$arr = array();
foreach($ar as $v){
$c = count($arr);
if($v == 1
------解决思路----------------------
($v != end($arr[$c-1]) +1)){
$arr[][] = $v;
}else{
$arr[$c-1][] = $v;
}
}
print_r($arr);
$s = '1,2,3,7,8';
$ar = explode(',', $s);
$arr = array();
foreach($ar as $v){
$c = count($arr);
if($v == 1
------解决思路----------------------
($v != end($arr[$c-1]) +1)){
$arr[][] = $v;
}else{
$arr[$c-1][] = $v;
}
}
$one = implode(',',$arr[0]);
$two = implode(',',$arr[1]);
echo "第一次连胜纪录:".$one;
echo "
";
echo "第二次连胜纪录:".$two;
?>