3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { protected static $build_keeper = []; public static function build(){ if(!isset(self::$build_keeper[static::class])){ self::$build_keeper[static::class] = new static(); } return self::$build_keeper[static::class]; } protected function __construct() { } } class b extends a { public function doSomeThing() { echo 2; } } class c1 extends a { public function doSomeThingElse() { echo 3; } } b::build()->doSomeThing(); c1::build()->doSomeThingElse();
Output for git.master, git.master_jit, rfc.property-hooks
23

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:
37.19 ms | 405 KiB | 5 Q