php 将二维数组拆分为多个数组,并固定拆分每组的个数
$newArr = [];
while(!empty($list)) {
$count = 10;
$tmpArr = [];
for($i = 0; $i< $count ; $i++) {
$tmpArr[] = array_pop($list);
}
$newArr[] = $tmpArr;
}
$newArr = [];
while(!empty($list)) {
$count = 10;
$tmpArr = [];
for($i = 0; $i< $count ; $i++) {
$tmpArr[] = array_pop($list);
}
$newArr[] = $tmpArr;
}
共有 0 条评论