#30496 [Opn->Bgs]: foreach wrong assignment with multidim arrays
| From: | derick@php.net | Date: | Wed, 20 Oct 2004 13:34:37 +0000 |
| Subject: | #30496 [Opn->Bgs]: foreach wrong assignment with multidim arrays | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67826@lists.php.net to get a copy of this message | ||
ID: 30496
Updated by: derick@php.net
Reported By: esartoni at omniaglobal dot net
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux
PHP Version: 4CVS-2004-10-20 (stable)
New Comment:
Works fine here.
Previous Comments:
------------------------------------------------------------------------
[2004-10-20 15:19:33] esartoni at omniaglobal dot net
With PHP v4.3.9 works ok!
------------------------------------------------------------------------
[2004-10-20 15:17:40] esartoni at omniaglobal dot net
Description:
------------
foreach doesn't work as expected when using multidimensional arrays.
Reproduce code:
---------------
<?php
$a=array();
$a[]=array("one", "two", "three");
$a[]=array("five", "six", "seven");
// Code 1 (THIS DON'T WORK AS EXPECTED)
foreach ($a as $value) {
echo join(",", $value)."\n";
}
/*
This code below is a workaround:
// Code 2 (THIS WORKS!)
foreach ($a as $key => $value) {
echo join(",", $value)."\n";
}
*/
?>
Expected result:
----------------
one,two,three
five,six,seven
Actual result:
--------------
Array,0
Array,1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30496&edit=1