The answer depends on what exactly you need to do with the arrays and how you need to do it.
If your arrays have similar indexes, and you need to use the same element from each array, you could do like
foreach ($array1 as $index => $value1) {
$value2 = $array2[$index];
// do stuff with $value1 and $value2 here
}
(Although in this case, particularly if you find yourself doing this a lot, you may want to think about using a single array of either objects or arrays, so that the data will always be together and easier to connect.)
Or, if the arrays have the same type of elements in it and you want to iterate over both in order, you could iterate over array_merge($array1, $array2)
. (If the arrays aren't numerically indexed, though, and particularly if they have the same stringy keys, one of the arrays' elements could replace the other. See the docs on array_merge for details.)
There are a bunch of other possibilities, depending on how you need the elements. (The question really doesn't provide any info on that.)