Posted by C. on 11/03/07 17:25
On 3 Nov, 15:15, "mantrid" <ian.dan...@virgin.net> wrote:
> Hello
> I wish to extract two arrays and use them simultaneously in a for each
> statement
> Ive tried
> 'foreach ($yearsarray as &$yearvalue, $percentarray as &$percentvalue) {'
> and also
> 'foreach ($yearsarray as &$yearvalue AND $percentarray as &$percentvalue) {'
>
If each entry in one array matches one in the other then:
foreach ($yeararray as $index=>$year) {
print $year, $percentarray[$index];
}
Even if these were not compound data structures (as indicated in the
remainder of your code) your data design is a mess; both values
should be held in the same record in the same array.
C.
[Back to original message]
|