Page 1 of 1

Direct array_keys() key value

Posted: Fri Aug 27, 2004 12:32 pm
by anjanesh

Code: Select all

$arr=array("a","b","c","d","e");
print_r (array_keys($arr,"d"));
Gives 0=>3
But somehow I want the value 3 directly.
This doesnt work....but something like this : echo (array_keys($arr,"d")[0]);
Any way to do this ?
Thanks

Posted: Fri Aug 27, 2004 12:46 pm
by feyd
[php_man]array_search[/php_man]