I have an array with the following format:
Array (  => Array ( [DateTime] => "2013-05-22 14:21:01" [Price] => 102.01 )  => Array ( [DateTime] => "2013-05-23 15:55:01" [Price] => 52.60 )  => Array ( [DateTime] => "2013-05-25 14:23:01" [Price] => 452.25 ) ... etc )
I need to discover the lowest and highest value of
min only returns they key. I've also tried
max(array_map("max", $data)) but that only returns
Will I have to use a
foreach and do it manually?
Here's one way to get the min and max values:
To return the nested array for the min and max:
You could do each in one line since that looked like what you were trying to do:
PHP >= 5.5.0 needed for
array_column()or use the PHP Implementation of array_column().
array_map()to get just the min and max:
There's probably a good