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); $a = hasort($a); var_dump($a);
based on SoZWF
Output for 4.3.0 - 7.1.0
array(5) { ["a"]=> int(10) ["z"]=> int(10) ["c"]=> int(10) ["d"]=> int(10) ["b"]=> int(11) }