3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Test { var $myVar = 10; function printMyVar(){ echo $this->myVar; echo "\n"; } } Test::printMyVar(); $test = new Test; $test->printMyVar(); $test->myVar = "Hello World"; $test->printMyVar();
Output for 7.0.0 - 7.1.0
Deprecated: Non-static method Test::printMyVar() should not be called statically in /in/t8tF3 on line 14 Fatal error: Uncaught Error: Using $this when not in object context in /in/t8tF3:8 Stack trace: #0 /in/t8tF3(14): Test::printMyVar() #1 {main} thrown in /in/t8tF3 on line 8
Process exited with code 255.
Output for hhvm-3.12.0
Fatal error: $this is null in /in/t8tF3 on line 8
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.1.3 - 5.6.28
Strict Standards: Non-static method Test::printMyVar() should not be called statically in /in/t8tF3 on line 14 Fatal error: Using $this when not in object context in /in/t8tF3 on line 8
Process exited with code 255.
Output for 5.0.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/t8tF3 on line 5 Strict Standards: Non-static method Test::printMyVar() should not be called statically in /in/t8tF3 on line 14 Fatal error: Using $this when not in object context in /in/t8tF3 on line 8
Process exited with code 255.
Output for 4.3.0 - 4.4.9
Notice: Undefined variable: this in /in/t8tF3 on line 8 10 Hello World