Jessé Catrinck
Jessé Catrinck

Reputation: 2277

Strange Invalid argument supplied for foreach()

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

enter image description here

I don't understand this error, because var is an array and not empty, but this error appears!

Upvotes: 0

Views: 119

Answers (1)

nni6
nni6

Reputation: 1000

Actually this line of code should not work:

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

array_push() returns integer and gets array as a first parameter..

Upvotes: 3

Related Questions