tags:

views:

19

answers:

1

I'm using krumo to output data from a page, all the data is accessible through the $page variable. I have a field called customer with the following structure:

customer (Array, 1 element) 
    0 (Array, 1 element) 
        id (String, 2 characters ) 85

How do i actually access id? I've tried $page->customer->id but it doesn't work. On the same level as customer, there's a string field called foo which I can access using $page->foo - so why doesn't my approach work?

A: 

If I'm not misunderstanding your question your solution would be:

$id=$page->customer[0]['id'];

A print_r() version would help too, maybe

lamas
Tried your suggestion, got:Fatal error: Cannot use object of type stdClass as array in
thatsCheating
Oh, I just saw that you are using a class - try again with what I wrote now please
lamas
Dude, it works! THANK YOU! :)
thatsCheating