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
The accepted answer fails to account for duplicates. Here is my take
public function sameElements($a, $b) { sort($a); sort($b); return $a == $b; }