Answers for "get the keys from another array by matching values"

0

get the keys from another array by matching values

<?php
  $array1 = array("a" => "green", "red", "blue");
  $array2 = array("b" => "green", "yellow", "red");
  $result = array_intersect($array1, $array2);
  print_r($result);
?>

#output
Array
(
    [a] => green
    [0] => red
)
Posted by: Guest on February-19-2021

Code answers related to "get the keys from another array by matching values"

Browse Popular Code Answers by Language