3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $config = ["a" => "green", "b" => "red", "d" => "blue"]; $allow = ["a","b","c"]; $result = \array_filter($config, function ($item) use ($allow) { return \in_array($item, $allow, true); }, \ARRAY_FILTER_USE_KEY); print_r($result);
based on GPrq8
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.3.0beta1
Array ( [a] => green [b] => red )