title: How to get this attribute value in XML using DOM
body: <p>Assuming i have an XML document as such,</p>
  
  <pre><code>&lt;node id="234" label="somewhere" &gt;
      &lt;attvalues&gt;
          &lt;attvalue for="ware" value="ews"/&gt;
          &lt;attvalue for="soft" value="sed"/&gt;
          &lt;attvalue for="time" value="121"/&gt;
          &lt;attvalue for="life" value="mone"/&gt;  
      &lt;/attvalues&gt;
  &lt;/node&gt;
  </code></pre>
  
  <p>How may i get only the value for "time" element which is 121 ?</p>
  
  <p>This is what i do to get the attibutes of node :</p>
  
  <pre><code>foreach($node-&gt;getElementsByTagName('attvalue') as $value){
  
              $enA[] = $value-&gt;getAttribute('for');
              $evA[] = $value-&gt;getAttribute('value');
  
  }
  </code></pre>
  
  <p>But what if i want only time attribute value ? because the code above gives all attributes and their values. I don't know how to be more specific.</p>
  
  <p>I tried something like </p>
  
  <pre><code> $evA[] = $value-&gt;getAttribute('time');
  </code></pre>
  
  <p>But doesn't work.</p>