3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Test { const OMG = 10; public function get($what) { return constant("self::" . $what); } } class Test2 { private $test = $test; public function __construct(Test $test) { $this->test = $test; } public function testFunc() { var_dump($this->test::OMG); } } $test = new Test(); $test2 = new Test2($test); var_dump($test2->testFunc());
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected '$test' (T_VARIABLE) in /in/G1cKL on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/G1cKL on line 14
Process exited with code 255.