3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function hasort($arr) { $a = $b = array(); foreach($arr as $v => $k) $a[$k][] = $v; ksort($a); foreach($a as $v => $i) foreach($i as $k) $b[$k] = $v; return $b; } $a = array('a' => 10, 'z' => 10, 'c' => 10, 'b' => 11, 'd' => 10,'e'=>11); $a = hasort($a); print_r($a);
based on fsQkS
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [a] => 10 [z] => 10 [c] => 10 [d] => 10 [b] => 11 [e] => 11 )