Why the refcount is 2 not 1?
$var = 1; debug_zval_dump($var); Output: long(1) refcount(2) $var = 1; $var_dup = &$var; debug_zval_dump($var);exit; Output : long(1) refcount(1) UPDATE Very disapointed at the answer... void debug_zval_dump ( mixed $variable ); Code : $var = 1; # $var's Refcount = 1 debug_zval_dump($var); # $var is passed by refrence intarlly. Output : long(1) refcount(2) Explanation : As $var's refcount is 1, PHP optimizes this and handles the memory directly instead of making a copy because there is no chance of contaminating any other references. PHP internally passing $var by reference, so that it can