3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ISingleton { public static function getInstance(): ISingleton; } abstract class Singleton implements ISingleton { private static $_instances = []; final private function __construct () {} final private function __clone() {} final private function __wakeup() {} final public static function getInstance() : ISingleton { self::$_instances[static::class] = self::$_instances[static::class] ?? new static(); return self::$_instances[static::class]; } } class Flextype extends Singleton { } var_export(Flextype::getInstance());
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Private methods cannot be final as they are never overridden by other classes in /in/m7AbZ on line 13 Warning: Private methods cannot be final as they are never overridden by other classes in /in/m7AbZ on line 14 Warning: The magic method Singleton::__wakeup() must have public visibility in /in/m7AbZ on line 14 \Flextype::__set_state(array( ))

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:
24.96 ms | 406 KiB | 5 Q