|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-10-25 14:47 UTC] PK at KoffieHosting dot com
Description:
------------
FastCGI (PHP5) on ISS 6.0: the foreach only shows the last item.
Reproduce code:
---------------
foreach ($_POST['Boxes'] as $Key => $Value);
{
echo '['.$Key.'] => '.$Value;
}
Note that this does work 100%:
while (list($What, $Amount) = each($_POST['Boxes']))
{
echo '['.$Key.'] => '.$Value;
}
Expected result:
----------------
[4] => 0
[2] => 0
[3] => 1
[6] => 0
[1] => 0
[5] => 0
Actual result:
--------------
[5] => 0
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 20:00:01 2025 UTC |
Remove the ";" at the end of the foreach() line. You have a foreach loop that does nothing and then the echo uses the last elements. This should work: foreach ($_POST['Boxes'] as $Key => $Value) { echo '['.$Key.'] => '.$Value; }