Display link from XML using PHP simpleXML
<p>Here is the code I have written, It should fetch the first entry in the atom feed from GitHub and display the commit description and a link to the commit on GitHub:</p>

<pre><code>$url = "https://github.com/moodle/moodle/commits/master.atom";
$rss = simplexml_load_file($url);
if($rss) {
$items = $rss-&gt;entry;
$i = 0;
foreach($items as $item) {
    $title = $item-&gt;title;
    $link = $item-&gt;link;
    echo '&lt;li class="github"&gt;';
    echo '&lt;span&gt;GitHub - moodle:master&lt;/span&gt;';
    foreach($link as $links) {
        echo $links-&gt;href;
        echo "&lt;a href=".$links-&gt;href."&gt;";
    }
    echo $title;
    echo '&lt;/a&gt;';
    echo "&lt;/li&gt;";

            if(++$i == 1) break;
}
}   
</code></pre>

<p>However I do not seem to be able to display the href from the link entity.</p>

<p>Can anyone explain or adjust the code to get the link displaying?</p>
