<?php
$justmove = array(0, 1, 2, 3, 4, 5);
$empty = array();
// $empty = new Array(); or new array(); doesn't work
$i = 0;
foreach ($justmove as $i) {
//global $justmove, $empty, $matchIndex; doesn't work
$i++;
$idontcare[$i]["whatever1"] = $justmove[0];
$idontcare[$i]["whatever2"] = $justmove[1];
$idontcare[$i]["whatever3"] = $justmove[2];
$empty = array_push($empty, $justmove[2]);
// &$empty doesn't work
}
var_dump($empty);
?>
Is what I have. Should return 2, 2, 2, 2, 2, 2 (as array objects). Returns null instead.
How would I fix that?
The errors (interpreter might be cutting further messages off):
PHP Warning: array_push() expects parameter 1 to be array, integer given in /home/IRIfGj/prog.php on line 18
PHP Warning: array_push() expects parameter 1 to be array, null given in /home/IRIfGj/prog.php on line 18
PHP Warning: array_push() expects parameter 1 to be array, null given in /home/IRIfGj/prog.php on line 18
PHP Warning: array_push() expects parameter 1 to be array, null given in /home/IRIfGj/prog.php on line 18
PHP Warning: array_push() expects parameter 1 to be array, null given in /home/IRIfGj/prog.php on line 18