3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Adapted from last example on http://nikic.github.io/2015/05/05/Internal-value-representation-in-PHP-7-part-1 $a = array(); // $a -> zend_array_1(refcount=1, value=[]) $b = $a; // $a, $b, -> zend_array_1(refcount=2, value=[]) $c = $b; // $a, $b, $c -> zend_array_1(refcount=3, value=[]) $x = $c; // $a, $b, $c, $x -> zend_array_1(refcount=4, value=[]) $d =& $c; $y =& $d; // $a, $b, $x -> zend_array_1(refcount=4, value=[]) // $c, $d, $y -> zend_reference_1(refcount=3) ---^ echo "Before\n"; debug_zval_dump($a); debug_zval_dump($b); debug_zval_dump($c); debug_zval_dump($d); $d[] = 1; // $a, $b, $x -> zend_array_1(refcount=3, value=[]) // $c, $d, $y -> zend_reference_1(refcount=3) -> zend_array_2(refcount=1, value=[1]) echo "After\n"; debug_zval_dump($a); debug_zval_dump($b); debug_zval_dump($c); debug_zval_dump($d);
Output for git.master, git.master_jit, rfc.property-hooks
Before array(0) interned { } array(0) interned { } array(0) interned { } array(0) interned { } After array(0) interned { } array(0) interned { } array(1) refcount(2){ [0]=> int(1) } array(1) refcount(2){ [0]=> int(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:
28.52 ms | 406 KiB | 5 Q