If you're not getting a count(array_diff($a1,$a2))>0 with something similar to the following arrays should use the php.net/array_diff_assoc function instead.
$a1 = Array
(
[0] => id
[1] => id_1
[2] => id_2
)
$a2 = Array
(
[0] => id
[1] => id_2
[2] => id_1
)