power failure when using f_put_contents for large file

84 Views Asked by At

When using file_put_contents in for loop, I tried this

for(loop) {
    file_put_contents("content ");
}

So if power failure occurs in middle of loop.
Some data should be written in the file.
But it is blank

I have the same problem with fputcsv()
I am closing and opening the file on every iteration of for loop when using fputcsv()

I tried this

for(loop) {
    open file;
    fputcsv();
    close;
}
0

There are 0 best solutions below