I have an array that when printed with print_r looks like this:
Array(
[0] => Color
[Color] => Array
(
[0] => Red
[1] => white
[2] => Bleu
)
[1] => size
[size] => Array
(
[0] => Small
[1] => Med
[2] => Large
)
)
I am trying to dump it to a csv file that should look like this when finished:
Color: Red, White, Blue
size: Small, "1-1/2 Inch", "8 inch"
The code below gets part of the job done but I am having trouble getting the array keys to print out at the beginning of each line in the csv file. Thanks.
<?php
print_r($mf_url_array);
$fp = fopen('file.csv', 'w');
fputcsv($fp, array_keys($mf_url_array));
foreach ($mf_url_array as $fields) {
if(!empty($fields) and is_array($fields)){
fputcsv($fp, $fields);
}
}
fclose($fp);
?>