Get count of files in directory
<?php $dir = new DirectoryIterator('/directoryPath/'); $count = 0; foreach($dir as $file) { $count += ($file->isFile()) ? 1 : 0; } print_r($count);