title: Cannot get to XML element with PHP
body: <p>I am processing a long piece of XML with PHP. I'm trying to get to a particular value, but having an issue:</p>
  
  <pre><code>$diag_data = simplexml_load_file($diagnostics);
  
  print_r($diag_data-&gt;category-&gt;category[2]-&gt;measure[3]);
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>SimpleXMLElement Object
  (
      [name] =&gt; Memory
      [value-list] =&gt; SimpleXMLElement Object
          (
              [item] =&gt; Array
                  (
                      [0] =&gt; SimpleXMLElement Object
                          (
                              [name] =&gt; allocated memory
                              [value] =&gt; 3,354 MB
                          )
  
                      [1] =&gt; SimpleXMLElement Object
                          (
                              [name] =&gt; free memory
                              [value] =&gt; 2,165 MB
                          )
  
                      [2] =&gt; SimpleXMLElement Object
                          (
                              [name] =&gt; maximum memory
                              [value] =&gt; 10,923 MB
                          )
  
                      [3] =&gt; SimpleXMLElement Object
                          (
                              [name] =&gt; total free memory
                              [value] =&gt; 9,734 MB
                          )
  
                  )
  
          )
  
  )
  </code></pre>
  
  <p>Then I try this:</p>
  
  <pre><code>print_r($diag_data-&gt;category-&gt;category[2]-&gt;measure[3]-&gt;value-list);
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>PHP Parse error:  syntax error, unexpected ')', expecting '(' in /var/www/html/xmltester.php on line 17
  </code></pre>
  
  <p>I don't get it, I've tried putting single and double quotes around value-list but nothing worked. I have also tried curly brackets. What am I doing wrong?</p>