note 115471 added to features.gc.refcounting-basics

From: Date: Wed, 30 Jul 2014 11:26:53 +0000
Subject: note 115471 added to features.gc.refcounting-basics
Groups: php.notes 
Request: Send a blank email to php-notes+get-200072@lists.php.net to get a copy of this message
It's very confusing. Code: $a = "new string"; $b = $a; //unset($b); xdebug_debug_zval( 'a' ); xdebug_debug_zval( 'b' ); Output: a: (refcount=2, is_ref=0),string 'new string' (length=10) b: (refcount=2, is_ref=0),string 'new string' (length=10) Code: $a = "new string"; $b = $a; unset($b); xdebug_debug_zval( 'a' ); xdebug_debug_zval( 'b' ); Output: a: (refcount=1, is_ref=0),string 'new string' (length=10) Variable containers get destroyed when the "refcount" reaches zero. Please tell me how variable b deleted. It has refcount 2. ---- Server IP: 72.52.91.14 Probable Submitter: 112.196.20.242 ---- Manual Page -- http://php.net/manual/en/features.gc.refcounting-basics.php Edit -- https://master.php.net/note/edit/115471 Del: integrated -- https://master.php.net/note/delete/115471/integrated Del: useless -- https://master.php.net/note/delete/115471/useless Del: bad code -- https://master.php.net/note/delete/115471/bad+code Del: spam -- https://master.php.net/note/delete/115471/spam Del: non-english -- https://master.php.net/note/delete/115471/non-english Del: in docs -- https://master.php.net/note/delete/115471/in+docs Del: other reasons-- https://master.php.net/note/delete/115471 Reject -- https://master.php.net/note/reject/115471 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200072) next »