As seen in this other answer, there are several ways to iterate two same-sized arrays simultaneously; however, all of the methods have a rather significant pitfall. Here ar
You can use a MultipleIterator:
$iterator = new MultipleIterator;
$iterator->attachIterator(new ArrayIterator($array1));
$iterator->attachIterator(new ArrayIterator($array2));
foreach ($iterator as $values) {
var_dump($values[0], $values[1]);
}
You can find more examples concerning the various options in the docs.