title: simplexml object selector not accepting variables?
body: <p>I'm trying to load an xml node <code>&lt;item id="n"&gt;</code>, where <code>id</code> is specified in <code>$id</code>.</p>
  
  <pre><code>$xml=simplexml_load_file("news.rss");
  foreach($xml-&gt;channel-&gt;item[$id]-&gt;attributes() as $a =&gt; $b) {
      echo $a,'="',$b,"\"\n";
  }
  </code></pre>
  
  <p>will return <code>PHP Fatal error:  Call to a member function attributes() on a non-object</code>.</p>
  
  <p>However, changing <code>$id</code> on line 2 to a number, like <code>1</code>, will make it work fine. What's going on here? <code>$id</code> is an integer.</p>