Page 1 of 1

How to get to value in a nested array

Posted: Sun Aug 10, 2008 1:17 am
by smalugu
Hi All,

I have an array of the following structure

Array ( [string1] => Array ( [0] => attrib Object ( [id] => 22:42 [identifier] => string1 [value] => diamond ) ) )

which I got my print_r.

Now my problem is how to get to the value which is corresponding to the [value] i.e here 'diamond'. :banghead:

I have tried several things including
$arr[0][0][value]
$arr->string1->value

or even a plain $arr[0] but i am getting syntax error.

Thanks for helping me

Re: How to get to value in a nested array

Posted: Sun Aug 10, 2008 4:46 am
by Oren
Try:

Code: Select all

$arr['string1'][0]->value