Direct array_keys() key value

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Direct array_keys() key value

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[php_man]array_search[/php_man]
Post Reply