3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array1 = array(1 => "green", 2 => "red", 3 => "blue", 4=> 'yellow'); $array2 = array(1=>'roxo', 2 => "green", 3 => "yellow", 4=>'blue', 5=> "red"); $result = array_intersect($array1, $array2); print_r($result);
based on pmnT0
Output for 4.3.0 - 7.1.0
Array ( [1] => green [2] => red [3] => blue [4] => yellow )