为foreach()提供的奇怪无效参数

时间:2014-07-31 13:57:18

标签: php arrays foreach

var_dump($ExtraColumns);
var_dump(is_array($ExtraColumns) );
foreach ($ExtraColumns as $key => $value) {
    $aColumns = array_push($aColumns, $value[1]);           
}

enter image description here

我不理解这个错误,因为var是一个数组而不是空的,但是出现了这个错误!

1 个答案:

答案 0 :(得分:3)

实际上这行代码不起作用:

$aColumns = array_push($aColumns, $value[1]);

array_push()返回integer并将array作为第一个参数..