I have this code that combines 3 arrays using array_map() to store them to a csv file to the format I like:
$list = array_map(null, $array1, $array2, $array3);
$filename = ‘file.csv’;
$fp = fopen($filename, ‘w’);
foreach ($list as $fields){
fputcsv($fp,$fields);
}
fclose($fp);
The problem is the array contains millions of rows so whenever I run my script, It always throws a Fatal Error: Allowed memory exhausted.
Is there a way to batch the storing of array_map() to the variable $list?
I tried finding a solution for this online for a few days now and all the solutions I found is not compatible with my code. I’m basically on my last straw here and I’m open on trying any idea you guys could come up with!