Labunski <mailto:[EMAIL PROTECTED]>
on Wednesday, March 03, 2004 3:31 PM said:
> Hello,
>
> // This will print first and sixth line from the text file:
> $file = file("people.txt");
> print "$file[0]<br>";
> print "$file[6]<br>";
actually that will print the first and seventh line of the file...
> // But how to print all the lines from [0] to [6] ?
> // Hope you understood my problem.
// to print ALL lines
foreach($file as $key => $value)
{
echo "$key: $value<br>";
}
// to print lines 1-7
for($ictr = 0; $ictr < 6; $ictr++)
{
echo "{$file[$ictr]}<br>";
}
> sorry for my bad english,
> Lab.
no problem.
hth,
chris.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php