title: count total items in a multidimensional array
body: <p>How can I count the total items in this array below?</p>
  
  <pre><code>Array
  (
      [upload] =&gt; Array
          (
              [name] =&gt; Array
                  (
                      [0] =&gt; 1024x768.jpg
                      [1] =&gt; 1280x800.jpg
                      [2] =&gt; 1280x1024.jpg
                      [3] =&gt; 1440x900.jpg
                  )
  
              [type] =&gt; Array
                  (
                      [0] =&gt; image/jpeg
                      [1] =&gt; image/jpeg
                      [2] =&gt; image/jpeg
                      [3] =&gt; image/jpeg
                  )
  
              [tmp_name] =&gt; Array
                  (
                      [0] =&gt; C:\wamp\tmp\php34FE.tmp
                      [1] =&gt; C:\wamp\tmp\php353D.tmp
                      [2] =&gt; C:\wamp\tmp\php356D.tmp
                      [3] =&gt; C:\wamp\tmp\php35AC.tmp
                  )
  
              [error] =&gt; Array
                  (
                      [0] =&gt; 0
                      [1] =&gt; 0
                      [2] =&gt; 0
                      [3] =&gt; 0
                  )
  
              [size] =&gt; Array
                  (
                      [0] =&gt; 469159
                      [1] =&gt; 602230
                      [2] =&gt; 739779
                      [3] =&gt; 707039
                  )
  
          )
  
  )
  </code></pre>
  
  <p>this is my method, but I think it's stupid! any better ways/ methods to count the total items inside the array?</p>
  
  <pre><code>&lt;pre&gt;
  &lt;?php if ($_FILES) {print_r($_FILES);}?&gt;
  &lt;/pre&gt;
  
  &lt;?php 
  echo count($_FILES['upload']['name']);
  
  if(empty($_FILES['upload']['name'][0]))
  {
      echo '0 file has been uploaded.';
  }
  ?&gt;
  </code></pre>
  
  <p>many thanks,
  Lau</p>