#35501 [NEW]: array storage and access

From: Date: Thu, 01 Dec 2005 11:40:12 +0000
Subject: #35501 [NEW]: array storage and access
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-89562@lists.php.net to get a copy of this message
From: robing9 at yahoo dot com Operating system: Windows XP SP2 PHP version: 5CVS-2005-12-01 (snap) PHP Bug Type: Arrays related Bug description: array storage and access Description: ------------ I am working with a uniserver with Apache 2.0.54, ActivePerl 5.8.7.813, PHP 5.0.4, MySQL 4.1.12a, phpMyAdmin-2.6.3-rc1 When I stored some data in a array with key field in integer but in a jumbled manner (insted of 1,2,3,4 as the key values i gave 0,1,4,2,3). Then when i printed it using the print_r function I got the data in the order of the key values 0,1,4,2,3. But shouldn't it have come in the order 0,1,2,3,4? I have written the code below. ******************************** PS : I couldnt find a relevant PHP version so I selected 5CVS 2005-12-01(snap) Reproduce code: --------------- <?php $x[0] = 'robin'; $x[1] = 'tony'; $x[4] = 'Sini'; $x[2] = 'pradeep'; $x[3] = 'prem'; print_r($x); ?> Expected result: ---------------- Array ( [0] => robin [1] => tony [2] => pradeep [3] => prem [4] => Sini ) Actual result: -------------- Array ( [0] => robin [1] => tony [4] => Sini [2] => pradeep [3] => prem ) -- Edit bug report at http://bugs.php.net/?id=35501&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35501&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35501&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35501&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35501&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35501&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35501&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35501&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35501&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35501&r=support Expected behavior: http://bugs.php.net/fix.php?id=35501&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35501&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35501&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35501&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35501&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35501&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35501&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35501&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35501&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35501&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35501&r=mysqlcfg

« previous php.bugs (#89562) next »