Hi everybody,
I don't have a clue where to start on this but all I want is a simple script that opens a textfile and searches the content for a word like bold and replaces it with <b> then it writes the new word to the textfile.
I'm very new to PHP and I sure could use some help.
Many thanks
Find and replacing a word in a textfile
Moderator: General Moderators
-
TheBentinel.com
- Forum Contributor
- Posts: 282
- Joined: Wed Mar 10, 2004 1:52 pm
- Location: Columbus, Ohio
Re: Find and replacing a word in a textfile
You'll want to look into fopen, fread, fwrite, and possibly file_get_contents.moop wrote:Hi everybody,
I don't have a clue where to start on this but all I want is a simple script that opens a textfile and searches the content for a word like bold and replaces it with <b> then it writes the new word to the textfile.
I'm very new to PHP and I sure could use some help.
Many thanks
http://www.php.net/fopen
http://www.php.net/fread
http://www.php.net/fwrite
http://www.php.net/file_get_contents
and for the replace
http://www.php.net/str_replace