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