title: Trouble reading XML tag attributes with PHP
body: <p>Given the following </p>
  
  <pre><code>&lt;data type="new"&gt;
       &lt;time&gt;1&lt;/time&gt;
       &lt;time&gt;2&lt;/time&gt;
  &lt;/data&gt;
  
   &lt;data type="old"&gt;
        &lt;time&gt;3&lt;/time&gt;
        &lt;time&gt;4&lt;/time&gt;
   &lt;/data
  </code></pre>
  
  <p>The goal being to type something along the following</p>
  
  <pre><code>   &lt;?php 
      $test = simplexml_load_file('http://....')
      echo $test-&gt;data['type="old"']-&gt;time[0] //I want this to return 3
     ?&gt;
  </code></pre>
  
  <p>and get the value of 3!
  I hate tried using attributes but I'm still on the search for the solution.</p>
  
  <p>Thanks,
  JTC</p>
  
  <p>The actually doc I'm trying to parse from</p>
  
  <pre><code>&lt;data type="current observations"&gt;
      &lt;time-layout time-coordinate="local"&gt;
          &lt;start-valid-time period-name="current"&gt;2013-05-27T13:53:00-04:00&lt;/start-valid-time&gt;
      &lt;/time-layout&gt;
  &lt;/data&gt;
  </code></pre>
  
  <p>I attempted the following but got an Invalid expression warning. </p>
  
  <pre><code>  $weather = simplexml_load_file('http://...');
    $time=$weather-&gt;xpath('//data[@type="current observations"]/"time-layout"/"start-valid-   time"');
    echo $time[0];
  </code></pre>