I feel bad about mixing arrays with objects, but I'm not sure that I should.
// Populate array
foreach($participants as $participant){
$participants[$key]['contestant'] = new Contestant($participant);
$participants[$key]['brand'] = new Brand($brand);
$key++;
}
[...]
// Print array
foreach($participants as $participant){
print "Name: " . $participant['contestant']->name;
print "Nationality: " . $participant['contestant']->nationality;
}
I'm not comfortable about the $contestant['contestant']->name
part. I'd feel better about using objects exclusively.
Is it in fact considered bad practice to mix objects and arrays, or am I obsessing over something that everyone else thinks is fine?