I'm trying to update an array but the array contains arrays.
For a example,
$data = array(
array('name'=>'John','age'=>'19','alive'=>'false'),
array('name'=>'Bob','age'=>'32','alive'=>'false'),
array('name'=>'Kate','age'=>'22','alive'=>'false'),
);
I need to add another element to all these arrays.
I tried using foreach
foreach($data as $onearray){
$onearray['alive'] = 'true';
}
Do I need to create a new array and add all updated arrays back to new one?