php - Hightest value of an associative array -


is there easy way hightest numeric value of associative array?

$array = array(     0 => array(         'key1' => '123',         'key2' => 'values we',         'key3' => 'do not',         'key4' => 'care about'     ),     1 => array(         'key1' => '124',         'key2' => 'values we',         'key3' => 'do not',         'key4' => 'care about'     ),     2 => array(         'key1' => '125',         'key2' => 'values we',         'key3' => 'do not',         'key4' => 'care about'     ) );  awesomefunction($array, 'key1'); // returns 2 ($array key) 

please kind since question written phone. thanks.

if know data in format, should work.

function getmax( $array ) {     $max = 0;     foreach( $array $k => $v )     {         $max = max( array( $max, $v['key1'] ) );     }     return $max; } 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -