I have chosen a Key =>
Value pair as my data structure where the Key is some text and the value is an array into which I will store objects.
Here is where I declare my Key =>
Value (array)
$array = array(
"key1" => array(),
"key2" => array(),
"key3" => array(),
);
I am trying to loop through and push a new object into the array, but I can't figure out how.
Something like:
While (...){
...
$object = new obj();
array_push($array['key1'], $object);
...
}
but with this I get the error
array_push() expects parameter 1 to be array
Can't you just do this:
Does the object need any kind of properties??
EDIT:
Try this modification:
Another possiblity??