3v4l.org

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

preferences:
183.17 ms | 1395 KiB | 58 Q