I want to convert an array to csv, im to convert an associative array to csv.
But you canโt get the headers.
I want DUMBER DYPE DATE to be dynamically displayed
Below is the array i converted.
Array ( [0] => Array ( [NUMBER] => 67 [TYPE] => Other [DATE] => 3/31/2011 ) [1] => Array ( [NUMBER] => 87 [TYPE] => something [DATE] => 3/28/2011 ) [2] => Array ( [NUMBER] => 67 [TYPE] => Other [DATE] => 3/2/2011 ) )
The code is below. But you canโt get the headers, but its values โโare approaching.
<? $fp1 = fopen('file.csv', 'w'); foreach ($arr2 as $fields) { fputcsv($fp1, $fields); } fclose($fp1); ?>
php
mark rammmy
source share