- array_intersect: documentation ( source)
- array_merge: documentation ( source)
- array_diff: documentation ( source)
<?php
$b = [1 => 1, 1 => 1];
$a = [4 => 1, 2=> 2];
if (count(array_diff(array_merge($a, $b), array_intersect($a, $b))) === 0) {
echo 'the same';
} else {
echo 'not the same';
}