PHP function to read how many files there are in a folder.
For example, there is a Pic folder with 100 pictures in it. The following function can get the total number of 100
<?php
$dir = './pic';
$handle = opendir($dir);
$i = 0;
while(false !== $file=(readdir($handle))){
if($file !== '.' || $file != '..'){
$i;
}
}
closedir($handle);
echo $i;
?>