3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class C { public function a() { echo __METHOD__ . "\n"; } public static function b() { var_dump($this); echo __METHOD__ . "\n"; } } $a = new C(); $a::b();
based on jod1s
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/r5KeI:12 Stack trace: #0 /in/r5KeI(18): C::b() #1 {main} thrown in /in/r5KeI on line 12
Process exited with code 255.
Output for 5.3.19 - 7.0.20
Notice: Undefined variable: this in /in/r5KeI on line 12 NULL C::b