Re: Delete Line from File?
| From: | Nick Wilson | Date: | Mon, 13 Sep 2004 13:36:01 +0000 |
| Subject: | Re: Delete Line from File? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-196501@lists.php.net to get a copy of this message | ||
* and then John Holmes declared....
> >Whats the easiest/best way to do that with php?
> >just replace the line with ''?
>
> Yes, basically. You have to read the file, replace the part you don't want
> with an empty string and then re-write the file. If the file is small and
> you're using file() to read it, you can just unset() the element you don't
> want, then join the array back together and write it.
Great, it just seems a bit clumsy which was why i thought maybe i was
looking at it the wrong way.. my thanks!
--
Nick W