3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = [ 0 => 'AXA', 1 => 'VHV', 2 => 'TEST', ]; $doctypes = [ 12 => 'AXA', 156 => 'VHV', 8 => 'TEST', ]; $tops = array_filter( $a, function (string $name, int $key) use ($doctypes) { return in_array($name, $doctypes); }, ARRAY_FILTER_USE_BOTH ); var_dump($tops); exit;
Output for 7.3.0rc3
array(3) { [0]=> string(3) "AXA" [1]=> string(3) "VHV" [2]=> string(4) "TEST" }