Organizational Research By

Surprising Reserch Topic

Question:array_intersect_key:Computes the intersection of arrays using keys for comparison using php



asked Sep 13, 2013 in PHP by rajesh
edited Sep 12, 2013
+1 vote
30 views



Related Hot Questions

1 Answer

0 votes

 

$array1 = array('blue'  => 1, 'red'  => 2, 'green'  => 3, 'purple' => 4);
$array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan'   => 8);
 
var_dump(array_intersect_key($array1, $array2));
?>
The above example will output:
array(2) {
  ["blue"]=>
  int(1)
  ["green"]=>
  int(3)
}
 
answered Sep 13, 2013 by rajesh
edited Sep 12, 2013

...