Hi,
I want to open a file, search for a string and replace it with another one.
The code I have written though, deletes everything from the file and writes nothing.
Any help?
code:
$handle = fopen("data.txt",'w');
$content = fread($handle, filesize("data.txt"));
$out = str_replace("test","found",$content);
$go = fwrite($handle,$out,filesize($out));
fclose($handle);