3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FooSingleton extends BarSingleton { private $foo_instance; public static function getInstance() { if (!self::$foo_instance) { self::$foo_instance = new self; } } } class BarSingleton { private $bar_instance; public static function getInstance() { if (!self::$bar_instance) { // Defer to FooSingleton self::$bar_instance = parent::getInstance(); } } } $foo = FooSingleton::getInstance(); $bar = BarSingleton::getInstance(); // This should be true var_dump($foo === $bar);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Cannot use "parent" when current class scope has no parent in /in/K2M1J on line 27
Process exited with code 255.

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:
47.69 ms | 401 KiB | 8 Q