|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-10-01 12:49 UTC] scottmac@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 09:00:01 2025 UTC |
Description: ------------ I assigned an associated array using each function from an array. But when using the list function the first element is not displaying. When commenting the second associated array which was created using the each function the code outputs all the values. Reproduce code: --------------- <?php $Greetings = array( 'First'=>'January', 'Second'=>'February', 'Third'=>'March', 'Fourth'=>'April', 'Fifth'=>'May'); $CurrentGreeting = each($Greetings); while(list($Language, $Greeting)= each($Greetings)) { echo $Language . ' is ' .$Greeting ."<br />"; } ?> Expected result: ---------------- First is January Second is February Third is March Fourth is April Fifth is May Actual result: -------------- Second is February Third is March Fourth is April Fifth is May