PDA

View Full Version : Get Line Count


Jasonb61
08-29-2002, 10:36 PM
Sorry about all the posts guys, I've just started out on PHP...

My new issue is... I need to know how to get the number of lines in a document.

Like if there are 25 lines in links1.txt, then it creates links2.txt and writes to that file.

(If that was confusing, I'm sorry!)

Thanks,
JohnnyX

mordred
08-29-2002, 11:47 PM
Perhaps like this


$lines = count(file('links1.txt'));

if ($lines == 25) {
$fp = fopen('links2.txt', 'w');
fwrite($fp, $lines);
fclose($fp);
}