3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public $test = 1; public function test() { return $this; } public function test2() { return clone $this; } } $a = new A; $b = $a->test(); $b->test = 2; var_dump($b->test); $c = $->test2(); $c->test = 3; var_dump($c->test);
based on 3khYa
Output for 7.0.0
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting variable (T_VARIABLE) or '{' or '$' in /in/tAieS on line 19
Process exited with code 255.
Output for 5.4.10 - 5.6.16
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting variable (T_VARIABLE) or '$' in /in/tAieS on line 19
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting T_VARIABLE or '$' in /in/tAieS on line 19
Process exited with code 255.