echo array value return form facebook api php -


i trying display array values return facebook api. array stored in $result below array

array (     [data] => array         (             [0] => array                 (                     [name] => ravi shankar                     [id] => 10206576743272319                 )          )      [paging] => array         (             [next] => https://graph.facebook.com/v2.5/1705944052976370/friends?limit=25&offset=25&__after_id=enc_adbv9zbljwwdjbl8iweiazbsxdqjo0gvqws45qwbbg1x8tcbzaoj9cz506zcgudnddol07mzd         )      [summary] => array         (             [total_count] => 4628         )  ) 

i tried using foreach confused

 foreach($result $key=>$value){      echo $key."-".$value."<br />";     } 

i want display result below:

    name    id     xxxx   123456     yyyy   173453 

you need use foreach in $result["data"]:

foreach ($result["data"] $friend) {   echo "{$friend["id"]} => {$friend["name"]}"; } 

the each $friend variable array, of format:

array (     [name] => ravi shankar     [id] => 10206576743272319 ) 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -