FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » foreach problem part two
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: foreach problem part two [message #184538 is a reply to message #184536] Tue, 07 January 2014 09:07 Go to previous messageGo to previous message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma:
Senior Member
John Smith wrote:

> On Fri, 20 Dec 2013 02:09:46 +0100, Christoph Michael Becker
> <cmbecker69(at)arcor(dot)de> wrote:
>
>> Assume, you have an array:
>>
>> $array = array('one', 'two', 'three');
>>
>> Now you want to echo its elements in order. What is simpler and more
>> readable?
>>
>> $i = 0;
>> while ($i < count($array)) {
>> echo $array[$i];
>> }
>
> At the first example you don't have to increment the $i?

Oops! Of course you'd have to:

$i = 0;
while ($i < count($array)) {
echo $array[$i];
$i++;
}

--
Christoph M. Becker
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP sql entry is a godaweful mess
Next Topic: Math Formula Question - Need Ideas
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 22:53:17 GMT 2024

Total time taken to generate the page: 0.05055 seconds