title: PHP - get value of an XML attribute
body: <p>source.xml</p>
  
  <pre><code>&lt;property&gt;
      &lt;name&gt;a&lt;/name&gt;
      &lt;description&gt;aaa&lt;/description&gt;
      &lt;example value="b" description="bbb"&gt;b1&lt;/example&gt;
      &lt;example value="c" description="ccc"&gt;c1&lt;/example&gt;   
  &lt;/property&gt; 
  </code></pre>
  
  <p>search.php</p>
  
  <pre><code>$xmlDoc=new DOMDocument();
  $xmlDoc-&gt;load("source.xml");
  $x=$xmlDoc-&gt;getElementsByTagName('property');    
  $z=$x-&gt;item(0);
  $c=$z-&gt;childNodes;
  for ($j=4;$j&lt;($cd-&gt;length);$j++) {
   echo ("&lt;div&gt;" . $c-&gt;item($j)-&gt;attributes()-&gt;description . "&lt;/div&gt;");
   echo ("&lt;div&gt;" . $c-&gt;item($j)-&gt;childNodes["description"] . "&lt;/div&gt;");
   echo ("&lt;div&gt;" . $c-&gt;item($j)["description"] . "&lt;/div&gt;");
  }
  </code></pre>
  
  <p>I want to return an attribute <code>description</code>. I have tried a lot, but nothing working correctly.</p>