3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = ['s', 'h', 'c', 'b', 'a', 'b', 'd', 'e', 'f', 'f', 'g']; arsort($array); $array = array_count_values($array); arsort($array, SORT_NUMERIC); var_export($array);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.31, 8.3.0 - 8.3.31, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
array ( 'f' => 2, 'b' => 2, 's' => 1, 'h' => 1, 'g' => 1, 'e' => 1, 'd' => 1, 'c' => 1, 'a' => 1, )

preferences:
67.96 ms | 1145 KiB | 4 Q