Re: Writing to a file

From: Date: Fri, 03 Jul 2009 13:11:00 +0000
Subject: Re: Writing to a file
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-294862@lists.php.net to get a copy of this message
2009/7/3 Sándor Tamás (HostWare Kft.) <sandortamas@hostware.hu>: > The classic method is: > 1.) read the whole file into an array of strings. > 2.) search for the last line > 3.) insert a string BEFORE the last line. > 4.) write back the whole file to the same name > > Classic file handling does allow you to append to the end of a file, or > recreate as a whole. > Usually these types of editing must be done in memory, because file handling > does not allow inserts, deletes. Please don't top-post in threads. It makes them difficult to read for folks searching the archives. -- </Daniel P. Brown> daniel.brown@parasane.net || danbrown@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig

« previous php.general (#294862) next »