3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TestClosure { private $a = 'a'; private $b = 'b'; $testClosure = function($var) use ($a, $b) { echo $var . ' ' . $this->a . ' ' . $this->b; }; $testClosure('hello!'); }
Output for 5.4.16
Parse error: syntax error, unexpected '$testClosure' (T_VARIABLE), expecting function (T_FUNCTION) in /in/nuOd6 on line 10
Process exited with code 255.
Output for 5.4.0 - 5.4.15
Parse error: syntax error, unexpected '$testClosure' (T_VARIABLE), expecting function (T_FUNCTION) in nuOd6 on line 10
Process exited with code 255.
Output for 5.3.25 - 5.3.26
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in /in/nuOd6 on line 10
Process exited with code 255.
Output for 5.3.0 - 5.3.24
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in nuOd6 on line 10
Process exited with code 255.

preferences:
177.21 ms | 1395 KiB | 51 Q