3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array('123', '456A', '78'); sort($a); print_r($a); $b = array('456A', '78', '123'); sort($b); print_r($b); $c = array('78', '123', '456A'); sort($c); print_r($c); $d = array('78', '456A', '123'); sort($d); print_r($d); while (list($chiave, $valore) = each($a)) { echo "A[" . $chiave . "] = " . $valore . "\n"; }
based on lf3uX
Output for 7.2.0
Array ( [0] => 123 [1] => 456A [2] => 78 ) Array ( [0] => 456A [1] => 78 [2] => 123 ) Array ( [0] => 78 [1] => 123 [2] => 456A ) Array ( [0] => 123 [1] => 456A [2] => 78 ) Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/TrL45 on line 8 A[0] = 123 A[1] = 456A A[2] = 78
Output for 4.3.0 - 7.1.7
Array ( [0] => 123 [1] => 456A [2] => 78 ) Array ( [0] => 456A [1] => 78 [2] => 123 ) Array ( [0] => 78 [1] => 123 [2] => 456A ) Array ( [0] => 123 [1] => 456A [2] => 78 ) A[0] = 123 A[1] = 456A A[2] = 78