Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #9798 > unrolled thread
| Started by | Kevin Davis <kevindavis338@gmail.com> |
|---|---|
| First post | 2013-06-19 07:34 -0700 |
| Last post | 2013-06-19 16:05 -0400 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.php
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
| From | Kevin Davis <kevindavis338@gmail.com> |
|---|---|
| Date | 2013-06-19 07:34 -0700 |
| Subject | For loop not showing the entire array |
| Message-ID | <ab435d0b-6f11-4859-9c25-45d9d24acff7@googlegroups.com> |
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
[toc] | [next] | [standalone]
| From | Kevin Davis <kevindavis338@gmail.com> |
|---|---|
| Date | 2013-06-19 07:58 -0700 |
| Message-ID | <7f2930ca-78c6-4377-85ee-d1768a67e96b@googlegroups.com> |
| In reply to | #9798 |
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
[toc] | [prev] | [next] | [standalone]
| From | Twayne <nobody@spamcop.net> |
|---|---|
| Date | 2013-06-19 16:05 -0400 |
| Message-ID | <kpt2tm$89h$1@speranza.aioe.org> |
| In reply to | #9799 |
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
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web