开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜