php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14068 2 while list each dont work
Submitted: 2001-11-15 06:56 UTC Modified: 2001-11-15 07:38 UTC
From: witterstein at web dot de Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0.5 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: witterstein at web dot de
New email:
PHP Version: OS:

 

 [2001-11-15 06:56 UTC] witterstein at web dot 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'

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-15 07:29 UTC] 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 07:29 UTC] bate@php.net
Andrey Hristov:

Try
reset($a); before the first while, and reset($b) just before the second in 
the body if the first.
 [2001-11-15 07:38 UTC] derick@php.net
Non-Bugs are bogus.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 09:01:28 2025 UTC