in Php i have written a code like below
//Example Code
foreach($arrayitem as $arr) //$arrayitem is having some array data
{
$fp=fopen($arr.'.xls','w');
for(condition)
{
//here i'm getting full content of an webpage(huge data) and some regexp to match data
preg_match(regexp,getContent of an URL,$output);
fputs($fp,$output);
}
fclose($fp);
}
The idea here is to create a file and write the data in the $output
variable and then creating the second file and writing the $output in that file and so on up-to the all values in the
$arrayitem
get finishes.
- but what i have observed is that the second file and other consecutive files are getting created before the completion of the first file
- And the file size is increasing slowly(on refresh the file size is changing)
how this can be possible ? what is actually happening here? normally the next file should be created only after completion of the first file right?