I want to read a file line by line, but without completely loading it in memory.
My file is too large to open in memory, and if try to do so I always get out of memo
'; $k= 1; $f= 1; $fp = fopen("texttranslate.txt", "r"); while(!feof($fp)) { $contents = ''; for($i=1;$i<=1500;$i++){ echo $k.' -- '. fgets($fp) .'';$k++; $contents .= fgets($fp); } echo ''; file_put_contents('Split/new_file_'.$f.'.txt', $contents);$f++; } ?>