<?php 
function TelCodeLijnen($map,$diepte = 0) {   

	$totaal = 0; 
		/*CONTROLE*/ 
		if (!$open = opendir($map)) { 
			echo '<b>Error:</b> "' . $map . '" kon niet worden geladen.<br />'; 
		} 
     
		while($read = readdir($open)) { 
			if($read != "." && $read != "..") { 
				$dirpos = $map . $read ; 
				/*MAP*/ 
				if(is_dir($dirpos)) {
					if ($diepte == 0) {
						$totaal += TelCodeLijnen($map . $read . '/',$diepte+1);
					}
					else {
						break;
					}
				} 
				/*BESTAND*/
				elseif(is_file($map . $read) AND is_readable($map . $read)) {
					$subtotaal = count(file($map . $read));
					$totaal = $totaal + $subtotaal;
				} 
       
			} 
		} 

return $totaal; 

} 

$aantal = TelCodeLijnen("./",0); 
echo 'Je website heeft <b>' . $aantal . '</b> lijnen code nodig om draaiend te blijven.'; 
?>  