3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php error_reporting(-1); class A { function B() { var_dump($this); } static function C() { var_dump($this); } } $a = new A(); A::B(); A::C();

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
Deprecated: Non-static method A::B() should not be called statically in /in/ifSTd on line 14 Fatal error: Uncaught Error: Using $this when not in object context in /in/ifSTd:5 Stack trace: #0 /in/ifSTd(14): A::B() #1 {main} thrown in /in/ifSTd on line 5
Output for Arrow functions
Deprecated: Non-static method A::B() should not be called statically in /in/ifSTd on line 14 Fatal error: Uncaught Error: Using $this when not in object context in /in/ifSTd:5 Stack trace: #0 /in/ifSTd(14): A::B() #1 {main} thrown in /in/ifSTd on line 5
Output for Object typehint
Deprecated: Non-static method A::B() should not be called statically in /in/ifSTd on line 14 Fatal error: Uncaught Error: Using $this when not in object context in /in/ifSTd:5 Stack trace: #0 /in/ifSTd(14): A::B() #1 {main} thrown in /in/ifSTd on line 5
Output for Array change keys
Deprecated: Non-static method A::B() should not be called statically in /in/ifSTd on line 14 Notice: Undefined variable: this in /in/ifSTd on line 5 NULL Notice: Undefined variable: this in /in/ifSTd on line 9 NULL
Output for Lexical anon
Strict Standards: Non-static method A::B() should not be called statically in /in/ifSTd on line 14 Notice: Undefined variable: this in /in/ifSTd on line 5 NULL Notice: Undefined variable: this in /in/ifSTd on line 9 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