title: count xml elements/nodes using SimpleXML
body: <p>this could be duplicate, but I found nothing useful so far.</p>
  
  <p>I'm trying to count <code>nodes/childs</code> of <code>XML</code> file using <code>simplexml</code>.</p>
  
  <p>I've tried this.</p>
  
  <pre><code>$xml = simplexml_load_file("./file.xml");
  echo count($xml-&gt;rss-&gt;channel-&gt;item);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>echo count($xml-&gt;item);
  </code></pre>
  
  <p>but just outputting <code>0</code>.</p>
  
  <p>here is snapshot of <code>XML</code></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;rss xmlns:xsd="http://www.w3.org/2001/XMLSchema"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xmlns:g="http://base.google.com/ns/1.0" version="2.0"&gt;
    &lt;channel&gt;
      &lt;item&gt;
        &lt;title&gt;PUDRA Pudra Ceket Ceket&lt;/title&gt;
        &lt;link&gt;http://www.trendyol.com//Pudra-Ceket-IW6140005046/UrunDetay/31066/9188683?&lt;/link&gt;
         &lt;description&gt;36 pudra pudra ceket ıw6140005046 ipekyol ceket kadın&lt;/description&gt;
         &lt;g:urunid&gt;1423905&lt;/g:urunid&gt;
         &lt;g:id&gt;1423905_14&lt;/g:id&gt;
      &lt;/item&gt;
      &lt;item&gt;
          ....
      &lt;/item&gt;
  </code></pre>