

ID: 90
Viewed: 4700
Added: Feb 27, 2002
Version:



Snippet uploaded by: snippet
Written By: snippet
Demo: Sorry, no demo



Thank you for your vote. Please wait...
It appears you already voted for this snippet
It appears your vote value was empty


This little script will read a file that has information in it like this:
this
is
a
test
And it will display it on the screen as such.
If you want to print out a certain line you would just change the $i to a number and add it to $fileread[1] and that will print out the certain line.
this
is
a
test
And it will display it on the screen as such.
If you want to print out a certain line you would just change the $i to a number and add it to $fileread[1] and that will print out the certain line.
<!---Head--->
none
<!---Body--->
<?
echo "<html>
<head>
<title></title></head>
<body>";
// opens the file to read
$fileread = file("file.txt");
// counts all the lines in the file
$arrlen = count($fileread);
//basic loop to print out to the screen according to the
for($i = 0; $i < $arrlen; $i++)
{
//prints out the whole list.
// if you want jsut a certain line, comment this one out.
echo"$fileread[$i]";
// this line will print out the second line in the file
//remember that 0 is the first line of the file.
echo $fileread[1];
}
echo"</body></html>";
?>
No Comments to show


Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.