note 20902 deleted from function.fopen by alindeman

From: Date: Sat, 17 May 2003 21:00:55 +0000
Subject: note 20902 deleted from function.fopen by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-48256@lists.php.net to get a copy of this message
Note Submitter: ellis@geeklab.net The example of appending to a file that is listed above states that you can append to a top of a file using $fp=fopen("file.txt", "aw"); is completely wrong! It will just append to the file. Here's a working method of how to add information to the top of your file: $a="content"; $file=join(" ",file("file.txt")); $fp=fopen("file.txt","w"); fputs($fp,$a); fputs($fp, $file); fclose($fp); Now if we could just get a "p" mode in fopen(), that would rock. *hint hint*

« previous php.notes (#48256) next »