dimanche 1 mars 2015

Getting values from arrays containing stdClass PHP objects

I'm obtaining information from the Facebook Graph API that returns an array that contains several stdClass Objects. I can easily read the "top" level items such as $myGraph['id'] = 123111193 in the example below.


Can anyone show me how to get data from the stdClass Objects, for example School Name in the following example created with print_r()?



Array
(
[id] => 123111193
[education] => Array
(
[0] => stdClass Object
(
[school] => stdClass Object
(
[id] => 108177302537907
[name] => State College Area High School
)

[type] => High School
[year] => stdClass Object
(
[id] => 117615364954534
[name] => 1975
)

)

[1] => stdClass Object
(
[concentration] => Array
(
[0] => stdClass Object
(
[id] => 193334910691838
[name] => Individual and Family Studies
)

)

[school] => stdClass Object
(
[id] => 113618111985274
[name] => Pennsylvania State University
)

Aucun commentaire:

Enregistrer un commentaire