get the matched value from 2 array in php

Solutions on MaxInterview for get the matched value from 2 array in php by the best coders in the world

showing results for - "get the matched value from 2 array in php"
Mallory
11 Aug 2020
1$a1=array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow");
2$a2=array("e"=>"red","f"=>"black","g"=>"purple");
3$a3=array("a"=>"red1","b"=>"red","h"=>"yellow");
4
5$result=array_intersect($a1,$a2,$a3);
6
7// Output
8// Array ( [a] => red )