3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Main { public function __construct() { Second::test2(); echo(' '); Second::test(); echo(' '); $this->test(); echo(' '); self::test(); echo(' '); } public function test() { echo('test'); } } class Second extends Main { public function test2() { echo('test2'); } } $php = new Main; $obj = new Second; $obj->test2(); echo(' '); $obj->test();
based on NPQ67
Output for 7.0.0 - 7.2.0
Deprecated: Non-static method Second::test2() should not be called statically in /in/6uDWD on line 4 test2 Deprecated: Non-static method Main::test() should not be called statically in /in/6uDWD on line 6 test test test test2 test test test test2 test
Output for 5.6.8 - 5.6.28
Deprecated: Non-static method Second::test2() should not be called statically, assuming $this from incompatible context in /in/6uDWD on line 4 test2 Deprecated: Non-static method Main::test() should not be called statically, assuming $this from incompatible context in /in/6uDWD on line 6 test test test test2 test test test test2 test
Output for 5.3.19 - 5.5.35
Strict Standards: Non-static method Second::test2() should not be called statically, assuming $this from incompatible context in /in/6uDWD on line 4 test2 Strict Standards: Non-static method Main::test() should not be called statically, assuming $this from incompatible context in /in/6uDWD on line 6 test test test test2 test test test test2 test