A simple task, but how to solve?

Got the name "keys" to each "key" attached to the number. Example:

21 key_one

18 key_two

56 key_three

You should print the name of the key which has the largest number.
March 19th 20 at 09:17
2 answers
March 19th 20 at 09:19
Solution
Try this

<?php

$data = [
 21 => 'key_one',
 18 => 'key_two',
 56 => 'key_three'
];
$keyMax = max(array_keys($data));
var_dump($data[$keyMax]);
March 19th 20 at 09:21
Function arsort key and will help You.

Find more questions by tags PHP