3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); error_reporting(-1); ini_set('display_errors', 'On'); class BaseModel { protected static $singleton; public static function __getInstance(): self { if (static::$singleton === null) { static::$singleton = __CLASS__; static::$singleton = new static::$singleton(); } return static::$singleton; } } class AModel extends BaseModel { protected static $singleton; /** ... */ } class BModel extends BaseModel { protected static $singleton; /** ... */ } echo get_class(AModel::__getInstance()), "\n"; echo get_class(BModel::__getInstance());
Output for rfc.property-hooks, git.master, git.master_jit
BaseModel BaseModel

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:
45.2 ms | 1458 KiB | 4 Q