I have two arrays, $a and $b here, and need to check if they contain exactly the same elements (independently of the order). I am thinking of using
if (sizeo
Just for your amusement I'll add an example that demonstrates that your conditions is not correct:
Test it.
I would suggest using a different model. Maybe adding the elements as keys of the array, but this is possible only if they are integers or strings.
$arr['itemA'] = true;
$arr['itemB'] = true;
This will enforce uniqueness. With this model you can use your condition on array_keys($arr).