[ create a new paste ] login | about

Link: http://codepad.org/2eSg7oVl    [ raw code | output | fork ]

PHP, pasted on Jun 12:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
$array = array(
'Element1', 
'Element2', 
'Element3', 
'Element1', 
'Element1', 
'Element4', 
'Element4', 
'Element2', 
'Element2', 
'Element2', 
'Element2', 
'Element4', 
'Element5', 
'Element5' );
$numbers = array_count_values($array);
asort($numbers);
$result = array_keys($numbers);
print_r($result);
?>


Output:
1
2
3
4
5
6
7
8
Array
(
    [0] => Element3
    [1] => Element5
    [2] => Element4
    [3] => Element1
    [4] => Element2
)


Create a new paste based on this one


Comments: