How can I parse this result?
Array (
[0] => stdClass Object (
[name] => query1
[fql_result_set] => Array ( [0] => stdClass Object ( [fan_count] => 226 ) ) )
[1] => stdClass Object (
[name] => query2
[fql_result_set] => Array ( [0] => stdClass Object ( [fan_count] => 247 ) ) )
[2] => stdClass Object (
[name] => query3
[fql_result_set] => Array ( [0] => stdClass Object ( [fan_count] => 580 ) ) )
[3] =&开发者_运维百科gt; stdClass Object (
[name] => query4
[fql_result_set] => Array ( [0] => stdClass Object ( [fan_count] => 10 ) ) )
[4] => stdClass Object (
[name] => query5
[fql_result_set] => Array ( [0] => stdClass Object ( [fan_count] => 508 ) ) )
)
How I can parse this result ?
I searched, but I didn't found out how I could do it.
Assuming your array variable is called $data
:
foreach ($data as $object) {
$name = $object->name;
$result_set = $object->fql_result_set;
$fan_count = $result_set[0]->fan_count;
// Do what you need to with the data here
}
Hope that helps
精彩评论