title: How to fix error "Use of undefined constant id - assumed 'id'" when parse xml file?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3626901/simplexml-reading-node-with-a-hyphenated-name">SimpleXML Reading node with a hyphenated name</a>  </p>
  </blockquote>
  
  
  
  <p>I parse xml file which contain fields like that: </p>
  
  <pre><code>&lt;offers&gt;
      &lt;offer&gt;
         &lt;type&gt;Vehicle&lt;/type&gt;
         &lt;type-id&gt;2&lt;/type-id&gt;
         &lt;category&gt;Car&lt;/category&gt;
         &lt;category-id&gt;3&lt;/category-id&gt;
         ...
      &lt;/offer&gt;
      &lt;offer&gt;
         &lt;type&gt;Vehicle&lt;/type&gt;
         &lt;type-id&gt;2&lt;/type-id&gt;
         &lt;category&gt;Car&lt;/category&gt;
         &lt;category-id&gt;3&lt;/category-id&gt;
         ...
      &lt;/offer&gt;
      ...
  &lt;/offers&gt;
  </code></pre>
  
  <p>Use <code>$xml = simplexml_load_file($file);</code> first and after trying to get values in foreach loop I get error "Use of undefined constant id - assumed 'id'"  for field contain 'id' as part of them, like 'type-id' or 'category-id'</p>
  
  <pre><code> foreach($xml-&gt;offers-&gt;offer as $offer) {
                      echo $offer-&gt;type; // WORKS JUST FINE
                  echo $offer-&gt;type-id; //THIS GIVE ME ERROR                              
                }      
  </code></pre>
  
  <p>I trying to set <code>ini_set('error_reporting', E_ALL &amp; ~E_NOTICE);</code> but after it field with 'id' return zero instead of value.</p>