Re: working with files

From: Date: Wed, 28 Jan 2004 20:02:00 +0000
Subject: Re: working with files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176111@lists.php.net to get a copy of this message
Did you try file(); ? -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com "Tony" <awardd@essex.ac.uk> skrev i meddelandet news:20040128195257.55560.qmail@pb1.pair.com... > hi, > > i have problem with writing a reading to file > i want to write emails in files. like this > email1@email1.com > email2@email2.com > email3@email3.com > etc...... > > this is how I write to the file > > $handle = fopen($filename, "a"); > fwrite($handle,"$email\n",128); > fclose($handle); > > > ok it writes everything just fine but now i want to read the file line by > line and print line by line. > this is how i do it. > > <?php > $handle = fopen ($filename, "r"); > > do { > $data = fread($handle, 128); > if (strlen($data) == 0) { > break; > } > print ("$data<br>"); > } while (true); > fclose($handle); > ?> > > > > the problem i get then is everything is printed in one line. > > > > any help is appreciated.

« previous php.general (#176111) next »