3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { function set_x($v) { $this->x = $v; } } $a = new A(); $a->set_x(1); A::set_x(2); echo $a->x;
Output for 7.0.0 - 7.1.0
Deprecated: Non-static method A::set_x() should not be called statically in /in/XjRnO on line 11 Fatal error: Uncaught Error: Using $this when not in object context in /in/XjRnO:5 Stack trace: #0 /in/XjRnO(11): A::set_x(2) #1 {main} thrown in /in/XjRnO on line 5
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Fatal error: $this is null in /in/XjRnO on line 5
Process exited with code 255.
Output for 5.0.0 - 5.6.28
Strict Standards: Non-static method A::set_x() should not be called statically in /in/XjRnO on line 11 Fatal error: Using $this when not in object context in /in/XjRnO on line 5
Process exited with code 255.
Output for 4.3.0 - 4.4.9
1