Reputation: 189
Using PHP, I am creating an array that contains multiple keys:
$loadAverage[$server] = $output["now"];
I am then checking the item with the lowest value
echo min($loadAverage);
but i need to get the key of the array not the value (so the $server
part i need)
the above is returning the value and not the key of the PHP array
Upvotes: 0
Views: 109
Reputation: 3925
$lowest_key = array_keys($loadAverage, min($loadAverage));
echo $lowest_key[0];
By supplying a search element you only get the key of that value.
Upvotes: 1