Jump to content

Maximum secondary Key in a multidimensional array


abdfahim

Recommended Posts

I want to get the maximum values of the second key of a multidimensional array. Write now I am using the code below, which works. But interested to know whether anybody has any better idea?

 

$arr['a']['2012-08-04']=100;
    $arr['a']['2012-08-01']=4545;
    $arr['a']['2012-08-07']=2434;
    $arr['b']['2012-08-02']=2334;
    $arr['b']['2012-08-03']=2324;
    
    $dt=array();
    foreach($arr as $val){
$dt=array_merge($dt,$val);
    }
    echo max(array_keys($dt));

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.