How to read this PHP array
I'm creating this array:
foreach($html->find('.position4') as $test) {
$aanvaller['naam'] = $test->find('.col1', 0)->plaintext;
$aanvaller['club'] = $test->find('.col2', 0)->plaintext;
$aanvaller['type'] = 'Aanvaller';
$aanvaller['wedstrijden'] = $test->find('.col3', 0)->plaintext;
$aanvaller['goals'] = $test->find('.col4', 0)->plaintext;
$aanvaller['punten'] = $test->find('.col5', 0)->plaintext;
$aanvallers[] = $aanvaller;
}
When I use print_r($aanvallers) I get this:
Array ( [0] => Array (
[naam] => Catalin Tira
[club] => ADO
[type] => Aanvaller
[wedstrijden] => 0
[goals] => 0
[punten] => 0 )
and a lot more values. But the array is filled with the right values. Now
I want to ready the values using this:
for($i=0; $i<count($aanvallers); $i++){
echo $aanvallers[$i]->naam;
}
But when I use this, I don't get any values showed. So what am I doing wrong?
No comments:
Post a Comment