Posted by farrell.niall on 03/22/07 19:17
Hi,
I'm trying to use nested foreach loops to loop through two arrays.
Each element in the first array corresponds to another array. The
brandcode part of the first array is the same as the name of the
corresponding array.
Basically, one array is of the brand info, and the second is of the
cars made by that brand.
To loop through all the brands, and then print their corresponding
cars, I tried:
foreach ($brands as $curbrand) {
foreach (${$curbrand['brandcode']} as $curcar) {
echo $curcar;
}
}
But I get "Invalid argument supplied for foreach()"
Any ideas?
[Back to original message]
|