This should work fine:
<?
$file = "song.txt";
if (file_exists($file)) {
$filedata = fopen($file,"r");
while (!feof ($filedata)){
$buffer = fgets($filedata, 4096);
print $buffer."<br>";
$howmany++;
}
//$lines = explode("\n", $buffer);
//$howmany = count($lines);
print "<br>";
print "There're <b>".$howmany."</b> song(s) in your file.";
fclose($filedata);
}
?>
Abraham
Dushanbe