phparrayskrumo

PHP/Krumo: accessing arrays within arrays?


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?


Solution

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

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

    A print_r() version would help too, maybe