Having problem displaying file read by file() function
Here is my code.
[php]<?php
$file = “log.txt”;
$lines = file($file);
for($i=0;$i<count($lines);$i++);
{
echo $lines[$i];
}
echo count($lines);
?>[/php]
My log.txt
user1 logged
user2 logged
user4 logged
user6 logged
user3 logged
user9 logged
The page is just a .php page, and my expectation was to see printed on the screen the same as the log.txt.
But all it displays is 5, or 20 , or 100, or however may logged users there are in the log.txt.
I am pretty noob so Im guessing this could be a fundamental error.
That id not the only thing I’ve tried I’ve trie a few other things such as this.
[php]<?php
$file = “log.txt”;
$lines = file($file);
for($i=0;$i<count($lines);$i++);
{
echo $lines[$i] . “
\n”; // and . “\n” and . “\r” and . “\r\n” etc
}
echo count($lines);
?>[/php]
I would really appreciate any pointers.