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


Groups > comp.lang.php > #14977 > unrolled thread

Re: 4d assoc array access

Started byDenis McMahon <denismfmcmahon@gmail.com>
First post2015-02-25 15:33 +0000
Last post2015-02-25 19:44 -0800
Articles 2 — 2 participants

Back to article view | Back to comp.lang.php


Contents

  Re: 4d assoc array access Denis McMahon <denismfmcmahon@gmail.com> - 2015-02-25 15:33 +0000
    Re: 4d assoc array access Albertestein <adnanshahi123@gmail.com> - 2015-02-25 19:44 -0800

#14977 — Re: 4d assoc array access

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2015-02-25 15:33 +0000
SubjectRe: 4d assoc array access
Message-ID<mckq0o$gmo$3@dont-email.me>
For some reason, every time I try and reply to the original post the 
message disappears.

On Mon, 23 Feb 2015 00:09:40 -0800 (PST) Adnan Shiekh 
<adnanshahi123@gmail.com> wrote:

> I have a question how to access 4 dimesional array efficiently in php

1) Your JSON is broken.

2) If you want json_decode to create an associative array in php you need 
to set the right options in the call to json_decode. Read the php manual 
for the json_decode function.

3) To access 'hello2' in the associative array generated from the 
corrected json data, use:

$result['output']['data'][1]['password']

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [next] | [standalone]


#14978

FromAlbertestein <adnanshahi123@gmail.com>
Date2015-02-25 19:44 -0800
Message-ID<408a7fb0-5bbb-4f30-9f4f-1d691d64380d@googlegroups.com>
In reply to#14977
On Wednesday, 25 February 2015 20:34:31 UTC+5, Denis McMahon  wrote:
> For some reason, every time I try and reply to the original post the 
> message disappears.
> 
> On Mon, 23 Feb 2015 00:09:40 -0800 (PST) Adnan Shiekh 
> <adnanshahi123@gmail.com> wrote:
> 
> > I have a question how to access 4 dimesional array efficiently in php
> 
> 1) Your JSON is broken.
> 
> 2) If you want json_decode to create an associative array in php you need 
> to set the right options in the call to json_decode. Read the php manual 
> for the json_decode function.
> 
> 3) To access 'hello2' in the associative array generated from the 
> corrected json data, use:
> 
> $result['output']['data'][1]['password']
> 
> -- 
> Denis McMahon, denismfmcmahon@gmail.com


1. No, i think json is not broken, basically it's received by website auto decode and store in to $result like that $result = $Classobj->getResponse($page);

2. i no need to convert the json..because it's auto return and store in associative array.


3. that's not correct.. i m send correct associative array in another post check this...

Correct is shown below but almost same..
$result['response']['result'][$i]['id'];
 
i want to access every id present in complete array 

but how to write loop to access all id elements in array...

thanks for your replying i hope you can understand..

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web