- array_map: documentation ( source)
- array_intersect: documentation ( source)
- json_encode: documentation ( source)
<?php
$a = array("a" => 1,"b" => array(1,2,3));
$b = array("a" => "x");
$c = array(1,2,3);
$x = array($a,$b,$b,$c);
$y = array($a,$b);
echo json_encode(array_intersect(array_map("json_encode",$a),array_map("json_encode",$b)));