title: simplexml_load_file parse [@attributes] => Array
body: <p>I am trying to parse this xml feed </p>
  
  <pre><code>[0] =&gt; SimpleXMLElement Object
              (
                  [title] =&gt; Johannesburg in November
                  [link] =&gt; SimpleXMLElement Object
                      (
                          [@attributes] =&gt; Array
                              (
                                  [rel] =&gt; alternate
                                  [type] =&gt; text/html
                                  [href] =&gt; http://www.tompeters.com/dispatches/012120.php?rss=1
                              )
  
                      )
  
                  [id] =&gt; tag:www.tompeters.com,2011://2.12120
                  [published] =&gt; 2011-09-08T14:03:23Z
                  [updated] =&gt; 2011-09-08T14:11:49Z
                  [summary] =&gt; Tom will be giving a day-long presentation in November in Johannesburg, South Africa. Our friends at the Business Results Group...
                  [author] =&gt; SimpleXMLElement Object
                      (
                          [name] =&gt; Shelley Dolley
                      )
  
                  [category] =&gt; SimpleXMLElement Object
                      (
                          [@attributes] =&gt; Array
                              (
                                  [term] =&gt; Announcements
                                  [scheme] =&gt; http://www.sixapart.com/ns/types#category
                              )
  
                      )
  
                  [content] =&gt; SimpleXMLElement Object
                      (
                          [@attributes] =&gt; Array
                              (
                                  [type] =&gt; html
                              )
  
                      )
  
              )
  </code></pre>
  
  <p>my PHP code to do so is </p>
  
  <pre><code>$url = 'http://www.tompeters.com/atom.xml';
                  $xml = simplexml_load_file($url);
  
                  echo '&lt;pre&gt;';
                  foreach($xml-&gt;entry as $entry){
                      echo $entry-&gt;title;
                      echo "&lt;br /&gt;";
                      foreach ($entry-&gt;link-&gt;@attributes as $attr){
                          echo $attr-&gt;href;
                          echo "&lt;br /&gt;";
                      }
                  }
  </code></pre>
  
  <p>the problem is that the <code>@attributes</code> bit breaks the code..</p>
  
  <p>How do i get that href link?</p>