title: How to get the value of an attribute from XML file in PHP?
body: <p>Sorry if this seems like an easy question, but I've started pulling hair out on this...</p>
  
  <p>I have a XML file which looks like this...</p>
  
  <pre><code>&lt;VAR VarNum="90"&gt;
    &lt;option&gt;1&lt;/option&gt;
  &lt;/VAR&gt;
  </code></pre>
  
  <p>I'm trying to get the <strong>VarNum</strong>. </p>
  
  <p>So far I've been successful using the follow code to get the other information:</p>
  
  <pre><code>$xml=simplexml_load_file($file);
  $option=$xml-&gt;option;
  </code></pre>
  
  <p>I just can't get VarNum (the attribute value I think?)</p>
  
  <p>Thanks!</p>