This is the code I made for my facebook application but it is not giving the result. This code generate friends name, id and gender and I simply want to display in my apps. Please help me in solving the problem?
<section>
<?php
$friends = idx($facebook->api('/me?fields=friends.limit(10).fields(gender,name)'),'data', array('access token' =>$accessToken));
?>
<div class="list">
<h3>Your friends</h3>
<ul class="things">
<?php
foreach ($friends as $friend) {
// Extract the pieces of info we need from the requests above
$id = idx($friend, 'id');
$item = idx($friend, 'name');
$gender= idx($friend,'gender');
// This display's the object that the user liked as a link to
// that object's page.
?>
<li>
<a href="https://www.facebook.com/<?php echo he($id); ?>" target="_top">
<img src="https://graph.facebook.com/<?php echo he($id) ?>/picture?type=square" alt="<?php echo he($item); ?>">
<?php echo he($item); ?>
</a>
<?php echo he($gender); ?>
</li>
<?php
}
?>
</ul>
</div>
</section>