title: PHP XML Processing, Read Attribute
body: <p>I'm using the simplexml_load_string function to process an xml string.</p>
  
  <p>The following is the xml string.</p>
  
  <pre><code>   &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
      &lt;metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#"    
      xmlns:ext="http://musicbrainz.org/ns/ext#-2.0"&gt;
      &lt;artist-list offset="0" count="1422"&gt;
         &lt;artist ext:score="100" type="Person" id="72c536dc-7137-4477-a521-567eeb840fa8"&gt;
         &lt;name&gt;Bob Dylan&lt;/name&gt;
         &lt;sort-name&gt;Dylan, Bob&lt;/sort-name&gt;
         &lt;gender&gt;male&lt;/gender&gt;&lt;country&gt;US&lt;/country&gt;
         &lt;life-span&gt;&lt;begin&gt;1941-05-24&lt;/begin&gt;&lt;/life-span&gt;
    &lt;/artist&gt;
    &lt;/artist-list&gt;
    &lt;/metadata&gt;
  </code></pre>
  
  <p>When the function returns I get the following array.
  I want to read the artist ext:score="value" but it doesn't get returned, how would I get this attribute of the tag?</p>
  
  <pre><code> SimpleXMLElement Object
   (
     [artist-list] =&gt; SimpleXMLElement Object
      (
          [@attributes] =&gt; Array
              (
                  [offset] =&gt; 0
                  [count] =&gt; 1422
              )
  
          [artist] =&gt; Array
              (
                  [0] =&gt; SimpleXMLElement Object
                      (
                          [@attributes] =&gt; Array
                              (
                                  [type] =&gt; Person
                                  [id] =&gt; 72c536dc-7137-4477-a521-567eeb840fa8
                              )
  
                          [name] =&gt; Bob Dylan
                          [sort-name] =&gt; Dylan, Bob
                          [gender] =&gt; male
                          [country] =&gt; US
                          [life-span] =&gt; SimpleXMLElement Object
                              (
                                  [begin] =&gt; 1941-05-24
                              )
                       }
                }      
       }
   }      
  </code></pre>