I appreciate there are already a lot of questions around this subject. But, as I\'m not a PHP developer, I\'m struggling to get anything to work for my specific object struc
I've created a function for that before. Bare in mind the code bellow does not assume there is any csv headers.
function doCSV($file, $content = array())
{
$handle = fopen($file, "w");
foreach($content as $value) {
fputcsv($handle, array(key($content), $value));
}
fclose($handle);
}
doCSV("test.csv", array("Test 1" => "Value 1", "Test 2" => "Value 2"));
If this is not what you're asking for let me know, I'll edit the answer.