note 13605 added to function.rewind.php
| From: | jason at cold-coffee dot com | Date: | Sat, 23 Jun 2001 19:41:45 +0000 |
| Subject: | note 13605 added to function.rewind.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14592@lists.php.net to get a copy of this message | ||
Alternatively, if you must write to the beginning of a file. You could simply open the file and then
read the contents of it and store as a variable. You can then append/merge this variable with the
variable containing the string which you wish to write to the file.
$file = fopen("fileName.inf", "r+");
$existingString = fread ($file, 2500000);
$printString = $newString . $existingString;
fputs ($file, $printString);
http://www.php.net/manual/en/function.rewind.php