3v4l.org

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