Hello. If I have the code which adds Car objects to an array:
for ( $counter = 0; $counter <= 10; $counter ++) {
$car= new CAR();
$car ->setRegistration("Registration" . $counter);
$carArray[$counter] = $car;
}
How do I retrieve them and use them as car objects ? I would expect that to print the registrations, it would be something like:
for ($i =0;$i < count($carArray);$i++){
echo ($carArray[$i] -> getRegistartion(););
But that produces an error of:
'Call to a member function getThreadName() on a non-object in...'
I expect I have to type cast the item in the array. But how? I expect something like:
$car = (Car) $carArray[$i];
But that fails too. Any help would be appreciated.
Thanks,
Matt.