PHP compare array


Question

Is there anyway to compare arrays in php using an inbuilt function, short of doing some sort of loop?

$a1 = array(1,2,3);
$a2 = array(1,2,3);

if (array_are_same($a1, $a2)) {
    // code here
}

Btw, the array values will not always be in the same order.

1
27
7/14/2013 11:43:53 AM

if ( $a == $b ) {
    echo 'We are the same!'
}
36
5/23/2009 4:12:26 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon