There are three single dimensional arrays that needs to be saved in csv
$arr1=array(1,2,3);
$arr2=array('a','b','c');
$arr3=array('x','y','z');
I need to save the above arrays in the csv like the following example-
1,a,x
2,b,y
3,c,z
I have tried the following code but its not saving in that format
$handle = fopen('file.csv', 'w');
$data=array($arr1,$arr2,$arr3);
foreach ($data as $line) {
fputcsv($handle, $line);
}
fclose($handle);
Output
1,2,3
a,b,c
x,y,z