Q:

PHP large array performance

I have a very large array in which i want to compare each element to its previous element.
Is it good practice (and better performance) if for each element i'm finished with i'll remove that element using array_pop?
Thanks.

A:

If I were you and I were dealing with a non associative array I would do
$n = count($array);
for($i = 1; $i < $n; $i++){
    //compare $array[$i] to $array[$i - 1]
}

