3v4l.org

run code in 300+ PHP versions simultaneously
<?php class demo { public $n = 0; function __construct() { $this->n =& $this->n; } function magic() { if ($this->n) return; } function set($n) { $this->n = $n; } } // Outputs 1 = 1 as expected $a1 = new demo(); $b1 = clone $a1; $a1->magic(); $b1->set(1); echo "{$a1->n} = {$b1->n}\n"; // Outputs 0 = 1 (magic() method is called a little earlier) $a2 = new demo(); $a2->magic(); $b2 = clone $a2; $b2->set(1); echo "{$a2->n} = {$b2->n}\n";
Output for git.master, git.master_jit, rfc.property-hooks
0 = 1 0 = 1

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