title: accessing SimpleXML attribute
body: <p>I am just getting started with Simple XML</p>
  
  <p>Parsing this data stored as $scorexml</p>
  
  <pre><code>SimpleXMLElement Object
  (
  [@attributes] =&gt; Array
      (
          [query-date-time] =&gt; 20141009T175358-0400
          [query-string] =&gt; hidden
          [hostname] =&gt; hidden.com
          [result-count] =&gt; 1
          [error-count] =&gt; 0
          [total-count] =&gt; 9
          [elapsed-time] =&gt; 13.0ms
      )
  
  [sports-content] =&gt; SimpleXMLElement Object
      (
          [sports-metadata] =&gt; SimpleXMLElement Object
              (
                  [@attributes] =&gt; Array
                      (
                          [doc-id] =&gt; xt.21794675-Golf_Leaderboard_XML
                          [date-time] =&gt; 20140914T150400-0400
                          [language] =&gt; en-US
                          [document-class] =&gt; event-summary
                          [fixture-key] =&gt; leaderboard
                          [revision-id] =&gt; xt.21792812-Golf_Leaderboard_XML
                      )
  
                  [sports-title] =&gt; $8,000,000 The Tour Championship Leaderboard
                  [sports-content-codes] =&gt; SimpleXMLElement Object
                      (
                          [sports-content-code] =&gt; Array
                              (
                                  [0] =&gt; SimpleXMLElement Object
                                      (
                                          [@attributes] =&gt; Array
                                              (
                                                  [code-type] =&gt; publisher
                                                  [code-key] =&gt; sportsnetwork.com
                                              )
  
                                      )
  
                                  [1] =&gt; SimpleXMLElement Object
                                      (
                                          [@attributes] =&gt; Array
                                              (
                                                  [code-type] =&gt; priority
                                                  [code-key] =&gt; normal
                                              )
  
                                      )
  
                                  [2] =&gt; SimpleXMLElement Object
                                      (
                                          [@attributes] =&gt; Array
                                              (
                                                  [code-type] =&gt; sport
                                                  [code-key] =&gt; 15027000
                                              )
  
                                      )
  
                                  [3] =&gt; SimpleXMLElement Object
                                      (
                                          [@attributes] =&gt; Array
                                              (
                                                  [code-type] =&gt; league
                                                  [code-key] =&gt; l.pga.com
                                              )
  
                                      )
  
                              )
  
                      )
  
              )
  
      )
  
  )
  </code></pre>
  
  <p>and trying to get </p>
  
  <pre><code>echo $scorexml-&gt;sports-content-&gt;sports-metadata['doc-id'];
  </code></pre>
  
  <p>but get an error when I try to echo it:</p>
  
  <blockquote>
    <p><code>Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';'</code></p>
  </blockquote>
  
  <p>Any help appreciated.</p>