The language is PHP. I have one foreach ( $a as $b) and another foreach ($c as $d => $e). How do i combine them to read as one. I tired foreach (($a as $b) && ($c as
This will do what you want I think. It will be advance both arrays equally at the same time throughout your loop. You can always break
manually if $c
is a different size than $a
and you need breaking logic based on array size:
foreach($a as $b)
{
list($d,$e) = each($c);
//continue on with $b, $d and $e all set
}
each()
will advance the array pointer of $c
on each iteration.