The following code exports the whole array into the .csv file, but I only want to export a specific column.
<?php
$test = array(array("eric", 7),array("nancy" ,8),array("dave", 10));
$fp = fopen('new.csv', 'w');
foreach ($test as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
?>
If you just want to export just the names, for example, do the following: