Get the maximum value from an element in a multidimensional array?

前端 未结 5 1365
轻奢々
轻奢々 2020-11-28 14:17

I\'m trying to select the maximum value for a particular key in a multidimensional array. I\'m having trouble \"getting to\" the key in question...

So, the array (

5条回答
  •  情话喂你
    2020-11-28 15:09

    If you like oneliners

    $max = max( array_map(function( $row ){ return $row->dnum; }, $myarray) );
    

提交回复
热议问题