3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $v; private static $_cli; private function __construct() { } public static function getCli() { if (!self::$_cli instanceof self) { self::$_cli = new self(); } return self::$_cli; } // override __clone() to private private function __clone() { } } $c1 = A::getCli(); $c1->v = 1; $c2 = $c1; $c2->v = 2; $c3 = clone $c1; $c3->v = 3; var_dump($c1->v, $c2->v, $c3->v);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to private A::__clone() from global scope in /in/QEWFA:27 Stack trace: #0 {main} thrown in /in/QEWFA 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:
64.66 ms | 401 KiB | 8 Q