title: php array, loop to get the exact value
body: <p>I have this code right here, where the <code>$friends</code> variable is an array with an output like this: </p>
  
  <pre><code>{
    "id": "1149862205",
    "name": "name",
    "first_name": "first_name",
    "last_name": "last_name",
    "link": "https://www.facebook.com/username",
    "username": "username",
    "birthday": "07/12/1990",
    "hometown": {
      "id": "108618265828550",
      "name": "name"
    }, 
  </code></pre>
  
  <p>while <code>$fbfriendlikes</code> variable is generated by the id of <code>$friends</code> and has this structure : </p>
  
  <pre><code>{
    "data": [
      {
        "name": "Penelope-ns-test",
        "category": "Community",
        "id": "187099821418102",
        "created_time": "2012-06-14T15:00:59+0000"
      },
  </code></pre>
  
  <p>Now, I need to print all <code>$friends</code> ids which like a specific id in <code>$fbfriendlikes</code>
  My code goes like this:</p>
  
  <pre><code>$friends = $facebook-&gt;api('/me/friends');
  if (!empty($friends['data'])) {
      $size = variable_get('facebook_graph_pic_size_nodes','square');
      $protocol = (isset($_SERVER['HTTPS']) &amp;&amp; $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
      foreach ($friends['data'] as $data) {
          $fbid = $data['id'];
          $fbfriendlikes[$fbid]=$facebook-&gt;api('/'.$fbid.'/likes'); 
          $fbname = $data['name'];
          $path = $protocol . '://graph.facebook.com/' . $fbid . '/picture?type=' . $size;
          $image = theme('image', array('path' =&gt; $path, 'alt' =&gt; $fbname));
  
          if ($fbfriendlikes["id"] != 184759054887922) {
              $return .= '&lt;div class="fimage"&gt;'.$image.'&lt;/div&gt;';
              $link = '&lt;a href="'.$protocol . '://www.facebook.com/profile.php?id='.$fbid.'" target="_blank"&gt;'.$fbname.'&lt;/a&gt;';    
              $return .= '&lt;div class="flink"&gt;'.$link.'&lt;/div&gt;';
              break;
          }
      }
  }
  </code></pre>
  
  <p>I know <strong>I have to do a foreach loop in <code>$fbfriendslikes</code> but I can't seem to make it work</strong>.
  Can you please give me an advice?</p>