scandir error: Invalid argument supplied for foreach()
<p>Can anyone help me out with this code? I can't seem to get it to work!</p>

<pre><code>&lt;?php
$file = scandir("../");

foreach ($files as $file) {
    if(is_dir($file) &amp;&amp; $file != '.' &amp;&amp; $file != '..' &amp;&amp; $file != 'images') {
        $folders++; // Counter
    } elseif(is_file($file) &amp;&amp; $file != '.' &amp;&amp; $file != '..' &amp;&amp; $file != 'index.php') {
        $total++; // Counter
    }
}

echo "$folders folders · $total files";
?&gt;
</code></pre>

<p>And the error I get is:</p>

<blockquote>
  <p>Invalid argument supplied for foreach()</p>
</blockquote>
