3v4l.org

run code in 500+ PHP versions simultaneously
<?php $variable[1] = ['A' => 'n', 'X' => 'n']; $variable[2] = ['A' => 'n', 'X' => 'Y']; $variable[3] = ['A' => 'B', 'X' => 'n']; $test = 'B'; $test2 = 'Y'; If(in_array($test, array_column($variable, "A"))){ Echo $test . " Found in A"; }Else if(in_array($test2, array_column($variable, "X"))){ Echo $test2 . " Found in B"; }else{ Echo "none found"; }

preferences:
33.25 ms | 1600 KiB | 5 Q