Compare the values of three arrays, and return the matches in PHP
Description
The following code shows how to compare the values of three arrays, and return the matches.
Example
//w w w . j a v a 2 s . co m
<?php
$a1=array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow");
$a2=array("e"=>"red","f"=>"black","g"=>"purple");
$a3=array("a"=>"red","b"=>"Basic","h"=>"yellow");
$result=array_intersect($a1,$a2,$a3);
print_r($result);
?>
The code above generates the following result.