Count number of files in folder in php
<pre><code>&lt;?php 
$directory = '/var/www/ajaxform/';
if (glob($directory . '.jpg') != false)
{
    $filecount = count(glob($directory . '*.jpg'));
    echo $filecount;
}
else
{
    echo 0;
}
?&gt;
</code></pre>

<p>there are four jpg images in this directory but it returns <code>0</code></p>
