3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array( 'A4' => array(), 'B10' => array(), 'D3' => array(), 'A20' => array(), 'A3' => array(), 'D22' => array(), 'D1' => array(), 'C2' => array(), 'B3' => array(), 'A1' => array(), 'B2' => array(), 'C11' => array(), ); ksort($array, SORT_NATURAL); echo implode(', ', array_keys($array)), PHP_EOL;
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
A1, A3, A4, A20, B2, B3, B10, C2, C11, D1, D3, D22
Output for 5.2.3 - 5.3.29
Warning: ksort() expects parameter 2 to be long, string given in /in/1nW6m on line 12 A4, B10, D3, A20, A3, D22, D1, C2, B3, A1, B2, C11
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.2.2
<br /> <b>Warning</b>: ksort() expects parameter 2 to be long, string given in <b>/in/1nW6m</b> on line <b>12</b><br /> A4, B10, D3, A20, A3, D22, D1, C2, B3, A1, B2, C11
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
<br /> <b>Warning</b>: ksort() expects parameter 2 to be long, string given in <b>/in/1nW6m</b> on line <b>12</b><br /> A4, B10, D3, A20, A3, D22, D1, C2, B3, A1, B2, C11PHP_EOL