3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $map = [ 'club' => [ 'fr' => 1, 'de' => 2, 'pl' => 3, ], 'shop' => [ 'de' => 10, ], ]; //foreach ($map as $context => $value) { // $result = array_flip($value); // if (isset($result[10]) && $context === 'shop') { // echo 'shop'; // return; // } //} //echo 'club'; foreach ($map as $context => $value) { if (in_array(10, $value)) { if ($context === 'shop') { echo 'shop'; return; } } } echo 'club';
based on KCPLv
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
shop