yoob
-
Posts
5 -
Joined
-
Last visited
Never
Posts posted by yoob
-
-
I know but is there a way i could somehow merge this reverse iterating with the 'for ($i=0;$i<10; $i++){'?
I mean, where should i put it? Seems all those $i's collide with each other -
Hmm, another problem.
See, i have this small piece of line reverse code, making the bottom lines of the file show up at the top. I've put it together myself so it may not be perfect:
[code]<?
$file=fopen("news/news.txt", "r");
flock($file,1);
$plik= array();
while (!feof($file)){
$plik[] = fgets($file,5000);
}
flock($file,3);
fclose($file);
for ($i=count($plik); $i>= 0; $i--){
echo $plik[$i];
}
?>[/code]
I try to merge it with the code you guys provided, but i dont think im skilled enough to understand all this. Could you help me out?
-
Thanks, all of these work like a charm, will keep them saved.
-
Hey guys
Can you tell me how to make a script that would open the file, and print out only the first 10 lines from it? First 10 from the top.
Print specific number of lines from a file.
in PHP Coding Help
Posted
[code] $number = count($plik)-10;
for ($i=count($plik); $i>=$number ; $i--){
echo $plik[$i];
}
[/code]
And it works ^______^
Thanks a lot.