In my nested empty iteration, $arr1 has 90000 items, when $arr2 has 9000 items, the whole nested iteration used less then 3 minutes,
but when $arr2 just add 1000 to 10000 items, the time fly to more then 100 minutes, so curious, have it to do with cpu,memory, IO or php itself?
$arr1 = array(...);
$arr2 = array(...);
$starttime = time();
foreach($arr1 as $v1){
foreach($arrs as $v2){
}
}
$endtime = time() - $starttime;
I recommend you to read some book of algorithmic complexity. (check this topic at google books)
The problem of 100 minutes is your algorithm design, not php, cpu ,etc (this also matters of course).
Seems yours is O(n^2) , but without code inside the for loops, I cant said if it is worse than that.
Hope it helps