I have a multidimensional array that is auto generated from a function. It looks like this:
Array(
[0] => Array
(
[0] => stdClass Object
(
[team] => Borussia Dortmund (gazeder)
)
[1] => stdClass Object
(
[team] => Real Madrid (Deycekslo)
)
)
[1] => Array
(
[0] => stdClass Object
(
[team] => Bayern Munchen (DaviiX)
)
[1] => stdClass Object
(
[team] => AS Roma (jakobmmm)
)
)
[2] => Array
(
[0] => stdClass Object
(
[team] => Chelsea (davorm9)
)
[1] => stdClass Object
(
[team] => Napoli (pubilegenda)
)
)
ETC...
So I have to extract the "team" values from it and store it into a database. The database part is not a problem, the problem is extracting. I tried several things as this one but it doesn't work:
$length = count($game->tour);
for ($row = 0; $row < $length; $row++) {
for ($col = 0; $col <= 2; $col++) {
echo "<p>".$game->tour[$row][$col]."</p>";
}
}
The only thing that works is that:
foreach($game->tour[0][0] as $array ) {
echo $array;
foreach($game->tour[0][1] as $array2 ) {
echo $array2;
}
}
foreach($game->tour[1][0] as $array ) {
echo $array;
foreach($game->tour[1][1] as $array2 ) {
echo $array2;
}
echo '<br />';
}
That one works fine but it's garbage because I need to be able to loop through that array and print all the "team" values. Any suggestions?
Thank you!