How to get key of array when i know this value in php -


this question has answer here:

i have array this:

$array = array('name'=>'van pham','age'=>'23','sex'=>'male'); 

how can key 'age' value '23'?

you looking array_keys http://www.php.net/manual/en/function.array-keys.php

print_r(array_keys($array, "23")); // age 

or hamza dzcyberdev

echo array_keys($array, "23")[0]; 

http://codepad.viper-7.com/bzergt


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -