3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { protected $val; public function __construct($val) { $this->$val = $val; } } $arr = array( 'one' => new test(10); 'two' => new test(1); 'three' => new test(5); ); uasort($arr, function (test $a, test $b) { if ($a->val == $b->val) { return 0; } return ($a->val < $b->val) ? -1 : 1; });
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.22
Parse error: syntax error, unexpected ';', expecting ')' in /in/6b39m on line 13
Process exited with code 255.

preferences:
193.74 ms | 1395 KiB | 58 Q