Getting $n number of maximum values
Posted
by
KPL
on Stack Overflow
See other posts from Stack Overflow
or by KPL
Published on 2011-01-01T07:17:58Z
Indexed on
2011/01/01
7:54 UTC
Read the original article
Hit count: 189
php
Hello all,
Straight to the question -
If $n = 3,
and input is -
Array
(
[04] => 3
[07] => 4
[01] => 5
[06] => 5
[05] => 5
[03] => 6
[08] => 6
[02] => 7
[09] => 8
[12] => 9
[10] => 10
[15] => 10
[19] => 11
[20] => 11
[13] => 12
[21] => 12
[16] => 13
[14] => 14
[22] => 14
[23] => 15
[11] => 15
[00] => 15
[17] => 17
[18] => 17
)
Output should be -
Array
( [14] => 14
[22] => 14
[23] => 15
[11] => 15
[00] => 15
[17] => 17
[18] => 17
)
Thank you, all, for help.
© Stack Overflow or respective owner