when counting lines the following code used:
$tr = fgets($fo, $file_length);
$total_rows = $total_rows + 1;
here $tr variable created where used can't understand. plz anybody help me?
the full scrip is given below:
<?php
$file = "data1.txt";
//-----Opening the file data1.dat.
//-----Is displayed.
$fo =@fopen($file, "r") or die("Could not locate the specified
file! Please check If the file is valid.");
//-----Calculating the total size of the file - test.txt.
$file_length = filesize($file);
echo "The total size of the file is: $file_length", "\n";
//---Reading the entire file row-wise. Each time a line ends,
//newline character is met, the variable
//---$total_rows Is Incremented by 1.
$total_rows=0;
while(!(feof($fo)))
{
$tr = fgets($fo, $file_length);
$total_rows = $total_rows + 1;
}
echo
echo "Total number of lines in this file is: $total_rows ",
"\n";
//---Closing data1.dat for the next loop to execute successfully.
fclose($fo);
?>

