<?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"; }
You have javascript disabled. You will not be able to edit any code.