3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Test { public function whatTheFuck() { ${'thi' . 's'} = 'tata'; $name = 'this'; var_dump($this); var_dump($$name); var_dump($this->getThis()); var_dump($$name->getThis()); // Fatal error! } public function getThis() { return $this; } } $t = new Test(); $t->whatTheFuck();
Output for 7.1.0
Fatal error: Uncaught Error: Cannot re-assign $this in /in/KjuQk:7 Stack trace: #0 /in/KjuQk(25): Test->whatTheFuck() #1 {main} thrown in /in/KjuQk on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.14
string(4) "tata" string(4) "tata" object(Test)#1 (0) { } Fatal error: Uncaught Error: Call to a member function getThis() on string in /in/KjuQk:15 Stack trace: #0 /in/KjuQk(25): Test->whatTheFuck() #1 {main} thrown in /in/KjuQk on line 15
Process exited with code 255.
Output for hhvm-3.12.0
Fatal error: Uncaught Error: Cannot re-assign $this in /in/KjuQk:7 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Fatal error: Cannot re-assign $this in /in/KjuQk on line 7
Process exited with code 255.
Output for 5.6.0 - 5.6.28
string(4) "tata" string(4) "tata" object(Test)#1 (0) { } Fatal error: Call to a member function getThis() on string in /in/KjuQk on line 15
Process exited with code 255.
Output for 5.0.0 - 5.5.38
string(4) "tata" string(4) "tata" object(Test)#1 (0) { } Fatal error: Call to a member function getThis() on a non-object in /in/KjuQk on line 15
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/KjuQk on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/KjuQk on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/KjuQk on line 5
Process exited with code 255.