"Tim Ward" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
is okay (but still doesn't work) although I have noticed that you seem to
need to code-block single statements in if ... else constructs
i.e
if (1==1) echo("fred") else echo("bill"):
should work but
.html
-Original Message-
From: Chris Fry [mailto:[EMAIL PROTECTED]]
Sent: 30 January 2001 03:56
To: Tim Ward
Cc: PHP News Group (E-mail)
Subject: Re: [PHP] Nesting 'foreach ()'
Tim,
Works fine in 4.04pl1 on NT.
I think you should have curly braces round the inner foreach as well
according to the online refernce foreach() doesn't change the array pointer.
However the following code:
$fred = array(1,2,3,4,5,6);
foreach ($fred as $fred1)
{ foreach ($fred as $fred2)
echo "$fred1 : $fred2br";
};
returns:
1 : 1
1 : 2
1 : 3
1 : 4
1 : 5
1 : 6
and stops
Tim,
Works fine in 4.04pl1 on NT.
I think you should have curly braces round the inner foreach as well?
$fred = array(1,2,3,4,5,6);
foreach ($fred as $fred1)
{ foreach ($fred as $fred2) {
echo "$fred1 : $fred2br";
}
};
Chris Fry
Tim Ward wrote:
according
Perhaps :
http://php.net/ChangeLog-4.php
Under 4.0.2 it says :
"Fixed problem with nested foreach()'s. (Andi, Zend Engine)"
philip
On Tue, 30 Jan 2001, Chris Fry wrote:
Tim,
Works fine in 4.04pl1 on NT.
I think you should have curly braces round the inner foreach as well?
$fred =
5 matches
Mail list logo