3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { protected $baz = 'foobar'; public function bar() { self::functionName(); $this->functionName(); } public function functionName() { echo $this->baz . "\n"; } } $f = new Foo(); $f->bar(); $f::functionName();
based on scPfE
Output for 7.0.0 - 7.2.0
foobar foobar Deprecated: Non-static method Foo::functionName() should not be called statically in /in/8srKc on line 21 Fatal error: Uncaught Error: Using $this when not in object context in /in/8srKc:15 Stack trace: #0 /in/8srKc(21): Foo::functionName() #1 {main} thrown in /in/8srKc on line 15
Process exited with code 255.
Output for 5.3.19 - 5.6.28
foobar foobar Strict Standards: Non-static method Foo::functionName() should not be called statically in /in/8srKc on line 21 Fatal error: Using $this when not in object context in /in/8srKc on line 15
Process exited with code 255.