I'm new to PHP. I have two arrays $array1
and $array2
of equal size. I've been using foreach
loops to iterate through arrays like so:
foreach($array1 as $element1) {
//Do stuff with $element1
}
and
foreach($array2 as $element2) {
//Do stuff with $element2
}
but now I'd like to iterate through both arrays at the same time so that I have access to both $element1
and $element2
in the loop body.
How do I do that?