3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Master { /** @var static $instance - singleton each class into its own! */ protected static $instance; /** * @return static */ final public static function getInstance() { if(static::$instance === null) { static::$instance = new static(); } return static::$instance; } protected function __construct() { echo "construct".__CLASS__." as ".static::class . " via " . self::class.PHP_EOL; } } class Slave extends Master { /** @var static $instance - singleton each class into its own! */ protected static $instance; protected function __construct() { echo "construct".__CLASS__." as ".static::class . " via " . self::class.PHP_EOL; } } class AnotherSlave extends Slave { /** @var static $instance - singleton each class into its own! */ protected static $instance; protected function __construct() { echo "construct".__CLASS__." as ".static::class . " via " . self::class.PHP_EOL; } } class FailedSlave extends Slave { // protected static $instance; protected function __construct() { echo "construct".__CLASS__." as ".static::class . " via " . self::class.PHP_EOL; } } $master = Master::getInstance(); $master = Master::getInstance(); $master = Master::getInstance(); $slave = Slave::getInstance(); $slave = Slave::getInstance(); $slave = Slave::getInstance(); $anotherSlave = AnotherSlave::getInstance(); $anotherSlave = AnotherSlave::getInstance(); $anotherSlave = AnotherSlave::getInstance(); $failedSlave = FailedSlave::getInstance(); $failedSlave = FailedSlave::getInstance(); $failedSlave = FailedSlave::getInstance();
Output for git.master_jit, git.master
constructMaster as Master via Master constructSlave as Slave via Slave constructAnotherSlave as AnotherSlave via AnotherSlave

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.81 ms | 405 KiB | 5 Q