Re: change word in a file
| From: | Pavel Jartsev | Date: | Sun, 07 Oct 2001 14:28:51 +0000 |
| Subject: | Re: change word in a file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70286@lists.php.net to get a copy of this message | ||
Alawi Albaity wrote:
>
> I have file and name it file.txt
>
> the file data is
>
> ----
> hello ho are vistor
> i love the vistor that visit my site
>
> ---
>
> now i want to change a word in my data
> this word is :
> vistor
>
> how can i do this ??
>
1) read data from file (http://www.php.net/manual/en/function.file.php)
2) replace values
(http://www.php.net/manual/en/function.ereg-replace.php)
3) write back to file (http://www.php.net/manual/en/function.fwrite.php)
--
Pavel a.k.a. Papi