3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class myClass { private $a = [ 'foo-test' => [1], '-' => [2], 'bar-test' => [3] ]; private function _mySort($x, $y) { var_dump($this->a); return $x < $y; } public function __construct() { uksort($this->a, [$this, '_mySort']); } } new myClass();
based on Otsn3
Output for 5.4.11 - 5.6.28, 7.0.6 - 7.2.0
array(3) { ["foo-test"]=> array(1) { [0]=> int(1) } ["-"]=> array(1) { [0]=> int(2) } ["bar-test"]=> array(1) { [0]=> int(3) } } array(3) { ["foo-test"]=> array(1) { [0]=> int(1) } ["-"]=> array(1) { [0]=> int(2) } ["bar-test"]=> array(1) { [0]=> int(3) } } array(3) { ["foo-test"]=> array(1) { [0]=> int(1) } ["-"]=> array(1) { [0]=> int(2) } ["bar-test"]=> array(1) { [0]=> int(3) } }
Output for 7.0.0 - 7.0.5
array(3) { ["foo-test"]=> array(1) { [0]=> int(1) } ["-"]=> array(1) { [0]=> int(2) } ["bar-test"]=> array(1) { [0]=> int(3) } } array(3) { ["foo-test"]=> array(1) { [0]=> int(1) } ["-"]=> array(1) { [0]=> int(2) } ["bar-test"]=> array(1) { [0]=> int(3) } } array(3) { ["foo-test"]=> array(1) { [0]=> int(1) } ["bar-test"]=> array(1) { [0]=> int(3) } ["-"]=> array(1) { [0]=> int(2) } }
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/9n9sX on line 5
Process exited with code 255.