i'm trying to create a csv file with emailadresses. But when i output the php array with fputcsv the output is Array,Array in stead of the data inside the array
I hope someone can help..
i have tried to remove all the lines that start with header( but then the same output comes to the screen.
Code:
header('Content-Description: File Transfer');
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename=emails.csv');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
$out = fopen('php://output', 'w');
fputcsv($out, array(
array('email', 'aantal keer ingevuld'),
array('[email protected]', '8')
)
);
fclose($out);
exit;
Output of a var_dump of the array:
array(2) { [0]=> array(2) { [0]=> string(5) "email" [1]=> string(20) "aantal keer ingevuld" } [1]=> array(2) { [0]=> string(24) "[email protected]" [1]=> string(1) "8" } }
output of the csv file:
Array,Array
Problem solved fputcsv only puts 1 array at a time. i have to use a loop with a multidimensional array.
Thanks for all the help!