I can not write an algorithm in php to get several keys from the array with the maximum value. My wrong example:
$a = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 4, 'f' => 3, 'g' => 5, 'h' => 5, 'i' => 2, 'j' => 1, ); for($i = 0; $i < $count; $i++) { $b = array_keys($a, max($a)); здесь, мне надо удалить из массива а ключ, чтобы не брать его снова. } There is another catch, I need to get the number of keys equal to the count, but there may be several identical maximum values in the array (since in my case these will be dates).
It turns out that if with count 3, I chose the values (4,4,3,2). I need to delete 2. With (4,3,3,2) - randomly one triple.
In general, get from the array N-th number of records, taking into account the same values.