3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function bar() { $nothing = isset($this) ? 'Instance' : 'Class'; } } class Baz { function test() { $objDateTime = new DateTime('NOW'); echo 'Baz->test()::DEBUT: ' . $objDateTime->format('c'); for($index=1; $index <10; $index++) { Foo::bar(); } $objDateTime = new DateTime('NOW'); echo 'Baz->test()::FIN: ' . $objDateTime->format('c'); } } $baz = new Baz; $baz->test(); class FooPropre { public static function barPropre() { $nothing = isset($this) ? 'Instance' : 'Class'; } } class BazPropre { function testPropre() { $objDateTime = new DateTime('NOW'); echo 'BazPropre->testPropre()::DEBUT: ' . $objDateTime->format('c'); for($index=1; $index <10; $index++) { FooPropre::barPropre(); } $objDateTime = new DateTime('NOW'); echo 'BazPropre->testPropre()::FIN: ' . $objDateTime->format('c'); } } $baz = new BazPropre; $baz->testPropre();
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Baz->test()::DEBUT: 2013-12-19T22:01:47+01:00 Fatal error: Uncaught Error: Non-static method Foo::bar() cannot be called statically in /in/W5vvf:12 Stack trace: #0 /in/W5vvf(20): Baz->test() #1 {main} thrown in /in/W5vvf on line 12
Process exited with code 255.
Output for 8.0.13
Baz->test()::DEBUT: 2013-12-19T21:01:47+00:00 Fatal error: Uncaught Error: Non-static method Foo::bar() cannot be called statically in /in/W5vvf:12 Stack trace: #0 /in/W5vvf(20): Baz->test() #1 {main} thrown in /in/W5vvf on line 12
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Baz->test()::DEBUT: 2013-12-19T22:01:47+01:00 Deprecated: Non-static method Foo::bar() should not be called statically in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically in /in/W5vvf on line 12 Baz->test()::FIN: 2013-12-19T22:01:47+01:00BazPropre->testPropre()::DEBUT: 2013-12-19T22:01:47+01:00BazPropre->testPropre()::FIN: 2013-12-19T22:01:47+01:00
Output for 7.3.32 - 7.3.33
Baz->test()::DEBUT: 2013-12-19T21:01:47+00:00Baz->test()::FIN: 2013-12-19T21:01:47+00:00BazPropre->testPropre()::DEBUT: 2013-12-19T21:01:47+00:00BazPropre->testPropre()::FIN: 2013-12-19T21:01:47+00:00
Output for 5.6.0 - 5.6.38
Baz->test()::DEBUT: 2013-12-19T22:01:47+01:00 Deprecated: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Deprecated: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Baz->test()::FIN: 2013-12-19T22:01:47+01:00BazPropre->testPropre()::DEBUT: 2013-12-19T22:01:47+01:00BazPropre->testPropre()::FIN: 2013-12-19T22:01:47+01:00
Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.1, 5.3.3 - 5.3.29, 5.4.0 - 5.4.40, 5.4.42 - 5.4.45, 5.5.0 - 5.5.24, 5.5.26 - 5.5.38
Baz->test()::DEBUT: 2013-12-19T22:01:47+01:00 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Baz->test()::FIN: 2013-12-19T22:01:47+01:00BazPropre->testPropre()::DEBUT: 2013-12-19T22:01:47+01:00BazPropre->testPropre()::FIN: 2013-12-19T22:01:47+01:00
Output for 5.3.2, 5.4.41, 5.5.25
Baz->test()::DEBUT: 2013-12-19T22:01:48+01:00 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Strict Standards: Non-static method Foo::bar() should not be called statically, assuming $this from incompatible context in /in/W5vvf on line 12 Baz->test()::FIN: 2013-12-19T22:01:48+01:00BazPropre->testPropre()::DEBUT: 2013-12-19T22:01:48+01:00BazPropre->testPropre()::FIN: 2013-12-19T22:01:48+01:00
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/W5vvf on line 9
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/W5vvf on line 23
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/W5vvf on line 23
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/W5vvf on line 23
Process exited with code 255.

preferences:
276.53 ms | 401 KiB | 423 Q