function get_line_count($folder, $pos) {
    global $ignoreList, $extList;
    if ( !is_dir($folder) ) return false;
    $dir = opendir($folder);
    while ($thisFile = readdir($dir))
    {
        if ( in_array($thisFile, $ignoreList) ) continue;
        $thisLoc = $folder.'/'.$thisFile;
        if ( is_dir($thisLoc) ) {
            $thisCount += get_line_count($thisLoc, $pos+1);    
            echo '<br/>';
            for ( $x = 1; $x <= $pos; $x++ ) echo '....';
            echo $thisFile.'/';
        }
        else {
            $thisExt = array_pop(explode('.',$thisFile));
            if ( !in_array($thisExt, $extList) ) continue;
            echo '<br/>';
            for ( $x = 1; $x <= $pos; $x++ ) echo '....';
            echo $thisFile.'/';
            $thisContents = file_get_contents($thisLoc);
            $thisContents = str_replace(array("nn","r"), "n",$thisContents);
            $thisContents = str_replace("nn", "n",$thisContents);
            $thisLines = count(explode("n",$thisContents));
            $thisCount += $thisLines;
            echo ' <b>('.$thisLines.')</b>';
        }
    }
    return $thisCount;
}

//File or folder names to ignore
$ignoreList = array('.htaccess','cgi-bin','.','..','error_log');
//Only files with these extensions will be checked
$extList = array('php','css','js','html');
//Set your starting dir
$startDir = $_SERVER['DOCUMENT_ROOT'];
$lines = get_line_count($startDir, 0);
echo '<p>'.$lines.' lines of code found.</p>';

There are probably ten billion ways to do this, BUT I was looking for a way to quickly see how many lines I had coded for a project. This will use a recursive function to loop through a directory, scanning for any php/xhtml/css/js files and counting how many lines they might have inside.

Have fun!