#20833 [Opn->Csd]: where is the third element?

From: Date: Thu, 05 Dec 2002 18:28:17 +0000
Subject: #20833 [Opn->Csd]: where is the third element?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-26777@lists.php.net to get a copy of this message
ID: 20833 Updated by: derick@php.net Reported By: mk75@virgilio.it -Status: Open +Status: Closed Bug Type: Arrays related Operating System: windows 2000Pro PHP Version: 4.2.3 New Comment: This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. I could reproduce this with 4.2.3 (on linux) but not anymore with 4.3.0RC2. The array index of "third" is 1 as expected too. Previous Comments: ------------------------------------------------------------------------ [2002-12-05 11:31:42] mk75@virgilio.it <?php $fruits= array ("first", -1 => "second","third" ); ?> <?php echo $fruits[0] ?> // print first </p> <?php echo $fruits[-1];?> // print second </p> <?php echo $fruits[1];?> // Notice: Undefined offset: 1 </p> <?php echo count($fruits) ?> // print 2! What's the key for element "third"? why array's size is 2? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20833&edit=1

« previous php.bugs (#26777) next »