#31012 [Opn->Bgs]: error with foreach

From: Date: Tue, 07 Dec 2004 21:28:22 +0000
Subject: #31012 [Opn->Bgs]: error with foreach
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-69902@lists.php.net to get a copy of this message
ID: 31012 Updated by: tony2001@php.net Reported By: DeyV at php dot pl -Status: Open +Status: Bogus Bug Type: *General Issues Operating System: win xp PHP Version: 4.3.10RC1 New Comment: Not a PHP bug -> bogus. Previous Comments: ------------------------------------------------------------------------ [2004-12-07 22:13:02] DeyV at php dot pl Interesting. Without Zend Optimizer-2.5.5 this work correctly. Sorry. ------------------------------------------------------------------------ [2004-12-07 17:55:29] tony2001@php.net Please, make sure that you disabled all Zend extensions (Zend Optimizer etc.) and try again. ------------------------------------------------------------------------ [2004-12-07 17:46:53] DeyV at php dot pl 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 this bug report at http://bugs.php.net/?id=31012&edit=1

« previous php.bugs (#69902) next »