title: php count xml elements isn't work fine when there is one element
body: <p>I have a problem in counting <code>xml</code> elements. Let's see an example.</p>
  
  <pre><code>&lt;products&gt;
    &lt;product&gt;
      &lt;id&gt;1&lt;/id&gt;
      &lt;name&gt;first&lt;/name&gt;
      &lt;url&gt;test1&lt;/url&gt;
    &lt;/product&gt;
    &lt;product&gt;
      &lt;id&gt;2&lt;/id&gt;
      &lt;name&gt;second&lt;/name&gt;
      &lt;url&gt;test1&lt;/url&gt;
    &lt;/product&gt;
  &lt;/products&gt;
  </code></pre>
  
  <p><strong>In php:</strong> For this example it counts fine:</p>
  
  <pre><code>count($array['products']['product']);
  // This gives me 2
  </code></pre>
  
  <p>But when I have only <strong>one</strong> product:</p>
  
  <pre><code>&lt;products&gt;
    &lt;product&gt;
      &lt;id&gt;1&lt;/id&gt;
      &lt;name&gt;first&lt;/name&gt;
      &lt;url&gt;test1&lt;/url&gt;
    &lt;/product&gt;
  &lt;/products&gt;
  </code></pre>
  
  <p>Now in php:</p>
  
  <pre><code>count($array['products']['product']);
  // This gives me 3 , number of sub elements of product (It must be 1)
  //(because in this case we have one product and there is no sub array for counting,
  //so instead of another product, features of product is counting)
  </code></pre>
  
  <p>Any idea?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I can use <code>count($array['products']);</code> when there is only one product. That's ok. BUT, I check the xml in a loop. How should I know whether it has one product or not? At first I must can count the product.</p>