Bug #14068 Updated: 2 while list each dont work
| From: | bate@php.net | Date: | Thu, 15 Nov 2001 12:29:55 +0000 |
| Subject: | Bug #14068 Updated: 2 while list each dont work | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-70559@lists.php.net to get a copy of this message | ||
ID: 14068
Updated by: bate
Reported By: witterstein@web.de
Old Status: Bogus
Status: Closed
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.0.5
New Comment:
Andrey Hristov:
Try
reset($a); before the first while, and reset($b) just before the second in
the body if the first.
Previous Comments:
------------------------------------------------------------------------
[2001-11-15 07:29:44] hholzgra@php.net
you have to reset() the arrays before
the loops start to reset the internal
array pointer (see http://php.net/each)
or better use the foreach loop instead
of while/each
------------------------------------------------------------------------
[2001-11-15 06:56:24] witterstein@web.de
<?php
$a[0]="x";
$a[1]="y";
$b[0]="z";
$b[1]="w";
$b[2]="u";
while (list($key,$val)=each($a) )
{
while (list($key2,$val2)=each($b) )
{
print "$key: $val - $key2: $val2<br>";
}
}
?>
'./configure' '--with-mysql' '--with-apache=../apache_1.3.20'
'--with-gd=../gd-1.8.3' '--enable-track-vars'
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14068&edit=1