<? //specify the filename $filename = "myfile.txt"; //do the count $lines = file($filename); $count = count($lines); //show the result echo("There are $count lines in the file"); ?>