PHP Directory count

Directory count

<?php
$dir = "folder";
$start = 0;

if ($handle = opendir($dir)) {
	while (false !== ($file = readdir($handle))) {
		if (is_dir($dir.$file)) {
			$start++;
		}
    	}
	closedir($handle);
}
echo $start . ' folders';
?>