I can achieve this easily enough with loops, but it seems messy and I wondered if there's something that could be done with array_map or similar?
Given the following array:
[1]=>
array(3) {
["foo"]=>
int(25)
["bar"]=>
int(100)
["total"]=>
int(125)
}
[2]=>
array(3) {
["foo"]=>
int(11)
["bar"]=>
int(38)
["total"]=>
int(49)
}
[3]=>
array(3) {
["foo"]=>
int(20)
["bar"]=>
int(100)
["total"]=>
int(120)
}
How would you go about flagging the index with the lowest total?
e.g. to change it to:
[1]=>
array(3) {
["foo"]=>
int(25)
["bar"]=>
int(100)
["total"]=>
int(125)
}
[2]=>
array(4) {
["foo"]=>
int(11)
["bar"]=>
int(38)
["total"]=>
int(49)
["lowest"]=>
bool(true)
}
[3]=>
array(3) {
["foo"]=>
int(20)
["bar"]=>
int(100)
["total"]=>
int(120)
}
(adding "lowest" => false to the other indexes is unnecessary but acceptable)
Many thanks, I can't get my head around it. My brain seems to be failing me, it's been a long day.