1--TEST-- 2References in debug_zval_dump() 3--FILE-- 4<?php 5 6$r = 1; 7$a = [&$r]; 8debug_zval_dump($a); 9$a[] =& $r; 10debug_zval_dump($a); 11unset($a[1]); 12debug_zval_dump($a); 13unset($r); 14// rc=1 singleton ref remains 15debug_zval_dump($a); 16 17?> 18--EXPECT-- 19array(1) refcount(2){ 20 [0]=> 21 reference refcount(2) { 22 int(1) 23 } 24} 25array(2) refcount(2){ 26 [0]=> 27 reference refcount(3) { 28 int(1) 29 } 30 [1]=> 31 reference refcount(3) { 32 int(1) 33 } 34} 35array(1) refcount(2){ 36 [0]=> 37 reference refcount(2) { 38 int(1) 39 } 40} 41array(1) refcount(2){ 42 [0]=> 43 reference refcount(1) { 44 int(1) 45 } 46} 47