RsD0p9BK
9/2/2016 - 4:51 AM

file__write_by_chunks.php

# Most memory-efficient way to split a variable sized chunks?

$handle = @fopen("path_to_your_file", "r");
if ($handle) {
    while (($buffer = fgets($handle, 1024)) !== false) {
        doSomethingWithChunk($buffer );
    }
    fclose($handle);
}

# http://stackoverflow.com/questions/21121037/most-memory-efficient-way-to-split-a-variable-sized-chunks