Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- str_replace() external file
- The Numerator
July 26, 2006, 9:58 pm
rate this thread
file from "songs/breathe.txt", and replace all instances of "<b" with
"<span" and "</b>" with "</span>". I know how I should use str_replace
and I tried to do this:
but it doesn't work.
Re: str_replace() external file
I've never tried that before, but I'm sure it's never going to do it.
What you should do is open the file and read it in
$file='[PATH TO FILE]';
$filethis=fopen($file,'rb') or die("Can't open TXT file '[FILENAME]'");
Then read each line of the file, doing your replace as you go.