note 7959 deleted from unset by jmcastagnetto

From: Date: Thu, 07 Sep 2000 13:56:54 +0000
Subject: note 7959 deleted from unset by jmcastagnetto
Groups: php.notes 
Request: Send a blank email to php-notes+get-4317@lists.php.net to get a copy of this message
Bug or feature but this is useful in 'for' cycles. After using an item we 'unset' it but the order is not modified. So 'for' will not be confused in this case $countnum=count($fooar); for ($counter=0;$counter<=($countnum-1); $counter++) { ...} but if you do that for ($counter=0;$counter<=(count($fooar)); $counter++) you will not find one or more elements but they are there. So I think that 'unset'-ing a variable which is a member of an array just blank it and the position will be blank. The number of elements in the array is decremented and this is I think because for PHP 'blank' element is not element.

« previous php.notes (#4317) next »