#20833 [NEW]: where is the third element?

From: Date: Thu, 05 Dec 2002 17:31:42 +0000
Subject: #20833 [NEW]: where is the third element?
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-26770@lists.php.net to get a copy of this message
From: mk75@virgilio.it Operating system: windows 2000Pro PHP version: 4.2.3 PHP Bug Type: Arrays related Bug description: where is the third element? <?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 bug report at http://bugs.php.net/?id=20833&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=20833&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=20833&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=20833&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=20833&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=20833&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=20833&r=support Expected behavior: http://bugs.php.net/fix.php?id=20833&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=20833&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=20833&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=20833&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20833&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=20833&r=dst IIS Stability: http://bugs.php.net/fix.php?id=20833&r=isapi

« previous php.bugs (#26770) next »