#25699 [Opn->Csd]: for does not execute from within foreach
| From: | richy at smilingsouls dot net | Date: | Tue, 30 Sep 2003 06:35:45 +0000 |
| Subject: | #25699 [Opn->Csd]: for does not execute from within foreach | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-48295@lists.php.net to get a copy of this message | ||
ID: 25699
User updated by: richy at smilingsouls dot net
Reported By: richy at smilingsouls dot net
-Status: Open
+Status: Closed
Bug Type: *Programming Data Structures
Operating System: Windows XP Home
PHP Version: 4.3.3
New Comment:
I figured out that the condition wasn't ever being met.
Previous Comments:
------------------------------------------------------------------------
[2003-09-30 02:18:23] richy at smilingsouls dot net
Description:
------------
I have tried several variations of trying to use a for loop from within
a foreach. In no case did the for loop execute.
I have no idea if this is simply not allowed, or a bug. But it has
frustrated me enough to report it!
This works neither on my home dev. server (Xitami, Windows XP, PHP
4.3.3 R4) or on my remote ISP which sports some flavor of Unix. See
server config at http://www.smilingsouls.net/phpinfo.php
Reproduce code:
---------------
function foo()
{
$foo[1] = 'test1';
$foo[2] = 'test2';
foreach($foo as $key => $value)
{
for($d = 0; $d == 10; $d++) {echo $d;}
}
}
function foo2()
{
$foo[1] = 'test1';
$foo[2] = 'test2';
foreach($foo as $key => $value)
{
loop_it();
}
}
function loop_it()
{
for($d = 0; $d == 10; $d++) {echo $d;}
}
$foo[1] = 'test1';
$foo[2] = 'test2';
foreach($foo as $key => $value)
{
loop_it();
}
Expected result:
----------------
each should output:
012345678910
012345678910
Actual result:
--------------
blank, nothing!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25699&edit=1