date_default_timezone_set('Asia/Shanghai');
$arr = array(
'' => array(,),
'' => array(,),
'' => array(,),
'' => array(,)
);
print_r($arr);
for($i=;$i<count($arr);$i++){ //count()的长度,unset处理后会变化,逻辑错误,没有unset,看不出错误~~~~~
if($i == ){
unset($arr[$i]);
continue;
}
echo $i;
array_push($arr[$i],'aaa');
}
print_r($arr);
缩进 减少缩进 注释 格式化
Array
(
[] => Array
(
[] =>
[] =>
)
[] => Array
(
[] =>
[] =>
)
[] => Array
(
[] =>
[] =>
)
[] => Array
(
[] =>
[] =>
)
)
02 //注意:这里的$i,没有3,因为数组的长度变化了;
Array
(
[] => Array
(
[] =>
[] =>
[] => aaa
)
[] => Array
(
[] =>
[] =>
[] => aaa
)
[] => Array
(
[] =>
[] => 3333 //注意;这里没有拼接上,因为unset后,数组的长度变化了;
)
)