ajsie
ajsie

Reputation: 79686

help with accessing an array/object

i have printed out the contents of an array/object (named 'document') with print_r. it looks like this:

Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [id] => 7006276 ) [name] => Arnessysla [type] => region [latitude] => 64.5833 [longitude] => -21.8833 [entities] => SimpleXMLElement Object ( ) ) ) 

how do i get the 'entities' contents?

i've tried this: $document[0]->attributes['entities']

but it didnt work!

Upvotes: 0

Views: 89

Answers (2)

Itay Moav -Malimovka
Itay Moav -Malimovka

Reputation: 53603

$document[0]->entities

Upvotes: 1

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798676

$document[0]->entities

@attributes is an array, but it ends after the first element because that's where the parens close. entities is a separate attribute of the same object.

Upvotes: 2

Related Questions