3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $userdb = [ [ '100', 'Sandra', 'urlof100' ], [ '5465', 'Stefanie', 'urlof5465' ], [ '40489', 'Michael', 'urlof40489' ] ]; foreach($userdb as $i => $e) { if (is_array($e) && in_array( "Sandra",$e ) ){ foreach($e as $k => $v) { if ($v == 'Sandra') { break; } } echo 'Yes, "Sandra" is in array in row ', $i, ', column ', $k; } } //alternatively: print_r(array_keys($userdb)); $res = array_search('Sandra',array_keys($userdb)); print_r($res);
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
Yes, "Sandra" is in array in row 0, column 1Array ( [0] => 0 [1] => 1 [2] => 2 ) 0