Re: Some advice on working with files
| From: | Oyvind Gronnesby | Date: | Tue, 27 Jun 2000 21:29:40 +0000 |
| Subject: | Re: Some advice on working with files | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3453@lists.php.net to get a copy of this message | ||
Ken N,
> Hi.
>
> I need to open a file and be able to delete and modify contents of it. I
> have looked at the file functions but it seems like I am a little limited.
> For instance, what if I wanted to open a file pick out 3 or 4 line os text
> and replace them? How best to do this. Sure I could use egrep_replace()
> but in php I can't egrep an entire file. Unless There's someting I don't
> know about.
>
> If anyone has dealt with this kind of situation and has some advice I
> would love to hear it.
If I was you I'd use the file-function and load the whole file into an
array, do the changes on the array and then rewrite the whole file from
scratch.
--
Øyvind Grønnesby
"Wow, I had knowledge!"
--Buffy