Reply to Re: While loop in array does not start with first entry

Your name:

Reply:


Posted by Geoff Berrow on 06/05/05 21:25

I noticed that Message-ID:
<42a33bbd$0$14739$9b4e6d93@newsread4.arcor-online.net> from Matthias
Braun contained the following:

>
>I am using arrays and a while loop for go through all the elements. The
>problem is that the first element is missing:
>
>while ($val = next($array))
>{
> $key = key($array);
>echo "$key: $val\n"
>
>}

That's what foreach is for

foreach ($array as $key => $value) {
echo "Key: $key; Value: $value<br />\n";
}


--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация