3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public static function wtf() { var_dump($this); } } class B extends A { public function run() { A::wtf(); } } $b = new B(); $b->run();

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
Fatal error: Uncaught Error: Using $this when not in object context in /in/94ABV:5 Stack trace: #0 /in/94ABV(11): A::wtf() #1 /in/94ABV(15): B->run() #2 {main} thrown in /in/94ABV on line 5
Output for Arrow functions
Fatal error: Uncaught Error: Using $this when not in object context in /in/94ABV:5 Stack trace: #0 /in/94ABV(11): A::wtf() #1 /in/94ABV(15): B->run() #2 {main} thrown in /in/94ABV on line 5
Output for Object typehint
Fatal error: Uncaught Error: Using $this when not in object context in /in/94ABV:5 Stack trace: #0 /in/94ABV(11): A::wtf() #1 /in/94ABV(15): B->run() #2 {main} thrown in /in/94ABV on line 5
Output for Array change keys
Notice: Undefined variable: this in /in/94ABV on line 5 NULL
Output for Lexical anon
Notice: Undefined variable: this in /in/94ABV on line 5 NULL

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page