title: Parsing XML tags with hyphens not working as expected
body: <p>Thanks in part to SO I was able to figure out how I can access XML tags with hyphens (&lt;some-tag&gt;). All the examples I have seen do it something like this.</p>
  <pre><code>$content = $xml-&gt;{'document-content'};
  </code></pre>
  <p>But for me that doesn't work, and this does</p>
  <pre><code>$content = $xml-&gt;{document-content};
  </code></pre>
  <p>that is without the quotes (how I figured that out I don't recall, a mistake maybe). If I use the quotes I get this error</p>
  <blockquote>
  <p>Notice: Trying to get property of non-object in /html/my/dir/myfile.php on line 26</p>
  </blockquote>
  <p>So one would think just use it without the quotes. Sure that is till I get to the reason I am parsing the XML. The XML is from an ODT file and will ultimately be used as template to generate PDF's. While developing anything I always use &quot;E_ALL&quot; error reporting. With it set I get these 2 errors when I use it without quotes.</p>
  <blockquote>
  <p>Notice: Use of undefined constant document - assumed 'document' in /html/my/dir/myfile.php on line 24</p>
  <p>Notice: Use of undefined constant content - assumed 'content' in /html/my/dir/myfile.php on line 24</p>
  </blockquote>
  <p>But, it does parse the rest of the document just fine. Problem is that I need to create a PDF and if it outputs that &quot;Notice&quot; error prior to the PDF generator running the &quot;header&quot; does not get set properly and no PDF is created. Now one might suggest I turn off error reporting, but then if the PDF isn't working I can't see those errors.</p>
  <p>In truth I am at a loss as to why it works at all without quotes. Everything I know about PHP syntax says that without quotes it would be a constant (as the error points out) that must be defined some where prior to it. As such the entire parser should fail at that point, but it doesn't, in fact the opposite is true the parser works.</p>
  <p>Mostly I just need to know how to get rid of those 2 notice errors, without disabling error reporting. And I would be very interested in why it works without the quotes, as how it is working seems to drastically deviate from all the norms of programing.</p>
  <p>Just in case its needed here is all the code leading up to &quot;$content&quot;</p>
  <pre><code>$zip = new ZipArchive;
  
  if ($zip-&gt;open('../docs/myfile.odt') === true)
  {
      $xmlstring = $zip-&gt;getFromName('content.xml');
      $zip-&gt;close();
  }
  
  // remove all namespaces and swaps out tab and space tags
  $replace = array('office:', 'style:', 'draw:', 'fo:', 'text:', 'svg:', '&lt;tab/&gt;', '&lt;s/&gt;');
  $value = array('', '', '', '', '', '', &quot;\t&quot;, '&amp;#160;');
  $xmlstring = str_replace($replace, $value, $xmlstring);
  
  $xmlstring = preg_replace_callback('/&lt;s c=&quot;(.+?)&quot;\/&gt;/s', 'ReplaceSpaces', $xmlstring);
  
  $xml = simplexml_load_string($xmlstring);
  $content = $xml-&gt;{document-content};
  </code></pre>