I am creating a system for creating files of a few kilobytes in size to say about 50 MB, and this question is more out of curiosity than anything else. I could not find the answers on the Internet.
If i use
$handle=fopen($file,'w');
where is the $ handle stored before I call
fclose($handle);
? Is it stored in system memory or in a temporary file somewhere?
Secondly, I create a file using a loop that takes 1024 bytes of data at a time, and writes the data each time as:
fwrite($handle, $content);
Then he calls
fclose($handle);
when the cycle is completed and all data is written. However, it would be more efficient or wise to use memory in a loop that executed
$handle = fopen($file, 'a'); fwrite($handle, $content); fclose($handle);
?
source share