#31012 [NEW]: error with foreach

From: Date: Tue, 07 Dec 2004 16:46:53 +0000
Subject: #31012 [NEW]: error with foreach
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-69894@lists.php.net to get a copy of this message
From: DeyV at php dot pl Operating system: win xp PHP version: 4.3.10RC1 PHP Bug Type: *General Issues Bug description: error with foreach Description: ------------ In this version in foreach without $key parametr, the $value always is returned as array, when 0 => value 1 => key Reproduce code: --------------- $a = array ( 1 => 'test1', 2 => 'test2', "three" => 1, "four" => 2, "five" => 3 ); foreach( $a as $v ) { print $v."\n"; } var_dump( $v ); Expected result: ---------------- test test2 1 2 3 int(3) Actual result: -------------- Array Array Array Array Array array(2) { [0]=> int(3) [1]=> string(4) "five" } -- Edit bug report at http://bugs.php.net/?id=31012&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31012&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31012&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31012&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31012&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31012&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31012&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31012&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31012&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31012&r=support Expected behavior: http://bugs.php.net/fix.php?id=31012&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31012&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31012&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31012&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31012&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31012&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31012&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31012&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31012&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=31012&r=mysqlcfg

« previous php.bugs (#69894) next »