I want to dynamically create arrays of arrays and I have no clue how to initialize my arrays...
Here is the code:
$resT= array();
$resR= array();
foreach ($cursor as $obj) {
if ($obj == NULL) continue;
$c="XX";
if (test1) $c=$obj['GC'];
array_push($resT[$c],$obj['AT']);
array_push($resR[$c],$obj['AR']);
}
I got this: array_push() expects parameter 1 to be array
Thanks,
Amir.
$resT= array();
$resR= array();
foreach ($cursor as $obj) {
if ($obj == NULL) continue;
$c="XX";
if (test1) $c=$obj['GC'];
if(!isset($resT[$c]))
$resT[$c] = array();
if(!isset($resR[$c]))
$resR[$c] = array();
array_push($resT[$c],$obj['AT']);
array_push($resR[$c],$obj['AR']);
}