note 17284 deleted from function.rewind by jimw
| From: | jimw@php.net | Date: | Tue, 18 Dec 2001 22:46:51 +0000 |
| Subject: | note 17284 deleted from function.rewind by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23284@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);