3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { protected $testArr; protected function test() { $testObj = new stdClass(); $testObj->foo = 'foo'; $this->testArr['test'] = $testObj; return $testObj; } $test = $this->test(); $test->foo = 'bar'; var_dump($this->testArr['test']); }
Output for 5.5.24 - 5.5.31, 5.6.8 - 5.6.17, 7.0.0 - 7.0.2
Parse error: syntax error, unexpected '$test' (T_VARIABLE), expecting function (T_FUNCTION) in /in/0MUH6 on line 15
Process exited with code 255.

preferences:
172.54 ms | 1400 KiB | 28 Q