$a = [1, 2, 3]; xdebug_debug_zval('a'); $b = $a; xdebug_debug_zval('a'); unset($b); xdebug_debug_zval('a');
This will lead to the conclusion
a: (refcount=2, is_ref=0)=array (2 => (refcount=0, is_ref=0)=1, 1 =>(refcount=0, is_ref=0)=2) a: (refcount=3, is_ref=0)=array (2 => (refcount=0, is_ref=0)=1, 1 => (refcount=0, is_ref=0)=2) a: (refcount=2, is_ref=0)=array (2 => (refcount=0, is_ref=0)=1, 1 => (refcount=0, is_ref=0)=2)
why in the first line refcount is 2
source share