<?php
$a = [
['foo', 'bar', 'baz="bazinga!"'],
['foo', 'bar', 'baz="bazinga!"'],
['foo', 'bar', 'baz="bazinga!"'],
['foo', 'bar', 'baz="bazinga!"'],
['foo', 'bar', 'baz="bazinga!"'],
['foo', 'bar', 'baz="bazinga!"']
];
ob_start();
$buffer = fopen('php://output', 'w');
array_walk($a, function ($row) use ($buffer) { fputcsv($buffer, $row); });
$csv = ob_get_clean();
echo $csv;
preferences:
23.79 ms | 408 KiB | 5 Q