Fwd: [PHP] Using PHP to remove certain number of bytes from file

From: Date: Sun, 30 Dec 2007 19:14:08 +0000
Subject: Fwd: [PHP] Using PHP to remove certain number of bytes from file
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-266375@lists.php.net to get a copy of this message
Maybe one of these days I'll remember to actually reply to the list the first time. ---------- Forwarded message ---------- From: Benjamin Darwin <bddarwin@gmail.com> Date: Dec 30, 2007 2:12 PM Subject: Re: [PHP] Using PHP to remove certain number of bytes from file To: Scott Wilcox <sc0tt@x0f.org> Try this: $file_data = file_get_contents('filename', false, null, 230); file_put_contents('filename', $file_data); This should do exactly what you need, although you may want to see if either one returns false (indicating an error) and stop the script. On Dec 30, 2007 12:20 PM, Scott Wilcox <sc0tt@x0f.org> wrote: > Is it possible with PHP to remove a certain number of bytes from a file, > purely within PHP? > > If so, does someone have an example of doing this, removing the first > 230 bytes from a file. > > Thanks, > > Scott. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Benjamin Darwin bddarwin@gmail.com "Dream as if you'll live forever, live as if you'll die today." ~James Dean

« previous php.general (#266375) next »