3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = array(1, 5, 2.5); $arr = array(); foreach ($str as $s) { $arr[$s][1]['a'] = $s; } echo '<pre>'; var_dump($arr); echo '</pre>'; ksort($arr); echo '<pre>'; var_dump($arr); echo '</pre>';
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<pre>array(3) { [1]=> array(1) { [1]=> array(1) { ["a"]=> int(1) } } [5]=> array(1) { [1]=> array(1) { ["a"]=> int(5) } } [2]=> array(1) { [1]=> array(1) { ["a"]=> float(2.5) } } } </pre><pre>array(3) { [1]=> array(1) { [1]=> array(1) { ["a"]=> int(1) } } [2]=> array(1) { [1]=> array(1) { ["a"]=> float(2.5) } } [5]=> array(1) { [1]=> array(1) { ["a"]=> int(5) } } } </pre>