```
When you want to know if two arrays contain the same values, regardless of the values' order, you cannot use "==" or "===". In other words:
```

<?php

(array(1,2) == array(2,1)) === false;

?>

To answer that question, use:

<?php

function array_equal($a, $b) {

return (is_array($a) && is_array($b) && array_diff($a, $b) === array_diff($b, $a));

}

?>

A related, but more strict problem, is if you need to ensure that two arrays contain the same key=>value pairs, regardless of the order of the pairs. In that case, use:

<?php

function array_identical($a, $b) {

return (is_array($a) && is_array($b) && array_diff_assoc($a, $b) === array_diff_assoc($b, $a));

}

?>

Example:

<?php

$a = array (2, 1);

$b = array (1, 2);

$a = array ('a' => 2, 'b' => 1);

$b = array ('b' => 1, 'a' => 2);

?>

(See also the solution "rshawiii at yahoo dot com" posted)