Overwrite Line in File with PHP

If the file is really big (log files or something like this) and you are willing to sacrifice speed for memory consumption you could open two files and essentially do the trick Jeremy Ruten proposed by using files instead of system memory. $source=”in.txt”; $target=”out.txt”; // copy operation $sh=fopen($source, ‘r’); $th=fopen($target, ‘w’); while (!feof($sh)) { $line=fgets($sh); … Read more