Here is my code:
<?php
$array = array("world", 1, "hello", 1, "hello", "hello", "how");
$new_array = array_count_values($array);
print_r($new_array);
?>
/* Output:
Array
(
[world] => 1
[1] => 2
[hello] => 3
[how] => 1
)
Now I want to sort the result based on the new array's value. So this is expected output:
/* Expected Output:
Array
(
[hello] => 3
[1] => 2
[world] => 1
[how] => 1
)
How can I do that?
Note: The order for the same values doesn't matter.