I have an array that I would like to add a new key=>value to using array_push. I haven't been able to figure out how to add both the key and the value. I'm sure it's something simple, but I have been staring at it for hours without luck.
I have tried using:
array_push($aAnimals['fish'], array('taste'=>'Good'));
but that just creates another sub array, which isnt right.
Can someone please show me how to do this?
Thank you in advance.
I have this array
$aAnimals['fish'] = array('move'=>'Fast','eat'=>'Lots');
Array
(
[fish] => Array
(
[move] => Fast
[eat] => Lots
)
)
I want to add this:
'taste'=>'good'
so I have this at the end.
Array
(
[fish] => Array
(
[move] => Fast
[eat] => Lots
[taste] => Good
)
)