Write an array to CSV in PHP Snippet·August 5, 2015 $out = fopen('php://output', 'w'); foreach ($rows as $row) { fputcsv($out, $row); } fclose($out);