3v4l.org

run code in 300+ PHP versions simultaneously
<?php function printForTest($a, $b) { var_dump($a); var_dump($b); var_dump (spl_object_hash($a) === spl_object_hash($b) ); print "\n"; } $a = new stdClass; $b = $a; $a->foo = "bar"; list ($cachedA, $cachedB) = unserialize(serialize([$a, $b])); $cachedA->hello = "world"; printForTest($cachedA, $cachedB); unset($cachedA, $cachedB); $cachedA = unserialize(serialize($a)); $cachedB = unserialize(serialize($b)); $cachedA->hello = "world"; printForTest($cachedA, $cachedB);
Output for git.master, git.master_jit, rfc.property-hooks
object(stdClass)#2 (2) { ["foo"]=> string(3) "bar" ["hello"]=> string(5) "world" } object(stdClass)#2 (2) { ["foo"]=> string(3) "bar" ["hello"]=> string(5) "world" } bool(true) object(stdClass)#2 (2) { ["foo"]=> string(3) "bar" ["hello"]=> string(5) "world" } object(stdClass)#3 (1) { ["foo"]=> string(3) "bar" } bool(false)

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:
39.54 ms | 402 KiB | 8 Q