Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9800

Re: For loop not showing the entire array

From Twayne <nobody@spamcop.net>
Newsgroups comp.lang.php
Subject Re: For loop not showing the entire array
Date 2013-06-19 16:05 -0400
Organization Aioe.org NNTP Server
Message-ID <kpt2tm$89h$1@speranza.aioe.org> (permalink)
References <ab435d0b-6f11-4859-9c25-45d9d24acff7@googlegroups.com> <7f2930ca-78c6-4377-85ee-d1768a67e96b@googlegroups.com>

Show all headers | View raw


Care to enlighten the rest of us what the solution was?

Twayne`



On 2013-06-19 10:58 AM, Kevin Davis wrote:
> Never mind,I found the solution myself.
>
> On Wednesday, June 19, 2013 9:34:59 AM UTC-5, Kevin Davis wrote:
>> Hi there,
>>
>>
>>
>> I'm stuck on something which I know could be simple..
>>
>>
>>
>> If you look at the following array:
>>
>>
>>
>> $data = json_decode($result, TRUE);
>>
>>
>>
>> then I have a counter:
>>
>>
>>
>>   $i = 0;
>>
>>
>>
>> then of course a loop:
>>
>>
>>
>> foreach ($data as $temp)
>>
>>   {
>>
>>      $userId = $data['data']['items'][$i]['id'];
>>
>>      echo $userId . "<BR>";
>>
>>      $i++;
>>
>>   }
>>
>>
>>
>> The problem is that the loop is only going through the first 2 records and there is more than 2... Is there a reason why?
>>
>>
>>
>> Thank you,
>>
>> Kevin
>

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

For loop not showing the entire array Kevin Davis <kevindavis338@gmail.com> - 2013-06-19 07:34 -0700
  Re: For loop not showing the entire array Kevin Davis <kevindavis338@gmail.com> - 2013-06-19 07:58 -0700
    Re: For loop not showing the entire array Twayne <nobody@spamcop.net> - 2013-06-19 16:05 -0400

csiph-web