3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { function test() { B::statCall(); } } class B { static function statCall() { var_dump($this); } } $a = new A(); $a->test();
Output for 7.1.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/NnOk6:15 Stack trace: #0 /in/NnOk6(7): B::statCall() #1 /in/NnOk6(21): A->test() #2 {main} thrown in /in/NnOk6 on line 15
Process exited with code 255.
Output for 5.5.0 - 7.0.14
Notice: Undefined variable: this in /in/NnOk6 on line 15 NULL
Output for 5.0.0 - 5.4.45
NULL
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/NnOk6</b> on line <b>13</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in <b>/in/NnOk6</b> on line <b>13</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in <b>/in/NnOk6</b> on line <b>13</b><br />
Process exited with code 255.