How to get common values from two different arrays in PHP -


i have 2 arrays user id

$array1 = array("5","26","38","42");  $array2 = array("15","36","38","42"); 

what need is, need common values array follows

$array3 = array(                  0=>"38",                  1=>"42"                 ); 

i have tried array_intersect(). method thats take minimum time of execution. please me friends..

native php functions faster trying build own algorithm.

$result = array_intersect($array1, $array2); 

Comments