I have an array of objects and I would like to access the values by the keys.
<?php
$name = [
[
'firstname' => 'John',
'lastname' => 'Doe',
'middlename' => 'Bray'
],
[
'firstname' => 'John2',
'lastname' => 'Doe2',
'middlename' => 'Bray2'
]
];
$count = count($name);
for($i = 0; $i < $count; $i++){
$cell = $name[$i];
echo $cell->lastname;
echo $cell->middlename;
}
?>
I thought that the 2 last lines would do but I get an error! What do I need to do o make it work?
Regards, Elio Fernandes