3v4l.org

run code in 300+ PHP versions simultaneously
<?php $objNoClone = new class extends stdclass { public function __construct(){ $this->a = 1; $this->b = 2; $this->c = 3; } }; $objWithClone = new class extends stdclass { public function __construct(){ $this->a = 1; $this->b = 2; $this->c = 3; } public function __clone(){} }; $counter = 0; foreach ($objNoClone as $p => $v) { echo "$counter : $v\n"; $clone = clone $objNoClone; $ref = &$objNoClone->$p; if (++$counter >= 5){ break; } } echo "\n\n"; $counter = 0; foreach ($objWithClone as $p => $v) { echo "$counter : $v\n"; $clone = clone $objWithClone; $ref = &$objWithClone->$p; if (++$counter >= 5){ break; } }
Output for git.master_jit, rfc.property-hooks, git.master
0 : 1 1 : 1 2 : 1 3 : 1 4 : 1 0 : 1 1 : 2 2 : 3

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.83 ms | 2710 KiB | 4 Q