note 17284 added to function.rewind
| From: | xprikry2 at fi dot muni dot cz | Date: | Mon, 03 Dec 2001 13:26:35 +0000 |
| Subject: | note 17284 added to function.rewind | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-21557@lists.php.net to get a copy of this message | ||
Result of previous example is file that contains:
$existingString.$newString.$existingString
If you only want to add text to the beginning of a file, you can use this:
$fp = fopen ("file.dat", "r");
$temp = fread ($fp, 2500000);
fclose ($fp);
$temp = $newstring.$temp;
$fp = fopen ("file.dat", "w");
fwrite ($fp, $temp);
fclose ($fp);
--
http://www.php.net/manual/en/function.rewind.php
http://master.php.net/manage/user-notes.php?action=edit+17284
http://master.php.net/manage/user-notes.php?action=delete+17284
http://master.php.net/manage/user-notes.php?action=reject+17284