3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static $my_static = 'foo'; public function staticValue() { return self::$my_static; } } class Bar extends Foo { public function fooStatic() { return parent::$my_static; } } print Foo::$my_static . "\n"; $foo = new Foo(); print $foo->staticValue() . "\n"; print $foo->my_static . "\n"; // Undefined "Property" my_static print $foo::$my_static . "\n"; $classname = 'Foo'; print $classname::$my_static . "\n"; // As of PHP 5.3.0 print Bar::$my_static . "\n"; $bar = new Bar(); print $bar->fooStatic() . "\n";
Output for git.master, git.master_jit, rfc.property-hooks
foo foo Notice: Accessing static property Foo::$my_static as non static in /in/sRKR9 on line 23 Warning: Undefined property: Foo::$my_static in /in/sRKR9 on line 23 foo foo foo foo

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

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


preferences:
43.69 ms | 401 KiB | 8 Q