Page 1 of 1

Read file and modify line by line before echo ??

Posted: Mon Nov 16, 2009 12:16 am
by Peuplarchie
Good day to you all,

I'm working on a script wich permit me to read a file line by line and echo it.

Here is my code now:

Code: Select all

 
 
<?php
 
$console = $_GET["console"];
$name = $_GET["name"];
 
 
$file = fopen("info_gen.txt", "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
while(!feof($file))
  {
  echo fgets($file). "<br />";
  }
fclose($file);
?> 
 
 

My problem is I need to be able to add or edit each and every line seperatly and differently before echo everyting.

How can I do so ?

Thanks!

Re: Read file and modify line by line before echo ??

Posted: Mon Nov 16, 2009 1:12 am
by Peuplarchie
I have tried but it don't work.

Thanks !

Re: Read file and modify line by line before echo ??

Posted: Mon Nov 16, 2009 1:13 am
by Peuplarchie
I don't know how to make it work that is why I have ask you help !

Re: Read file and modify line by line before echo ??

Posted: Mon Nov 16, 2009 7:49 am
by Peuplarchie
I had to use array, thanks !