3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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->getVal() < $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/pt7JI 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/pt7JI on line 10
Process exited with code 255.