note 42981 added to function.fgets
| From: | Evan at rn2 dot php dot net | Date: | Sat, 05 Jun 2004 18:41:56 +0000 |
| Subject: | note 42981 added to function.fgets | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70690@lists.php.net to get a copy of this message | ||
I have found this code to work well for jsut reading a file. The first part just reads it in the
second writes out. I didn't actually make this up , found it in a book somewhere
//read in assuming the file has been opened this line will close the file too.
$array = file("textFile.txt");
//write out
foreach ($array as $s)
@fwrite($fh, "$s");
its pretty sweet for short files.
Evan
----
Manual Page -- http://www.php.net/manual/en/function.fgets.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42981
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42981&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42981&report=yes
Search -- http://master.php.net/manage/user-notes.php