3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php if (isset($_GET['cmd']) && $_GET['cmd'] == 'print'){ $list = array ( array('aaa', 'bbb', 'ccc', 'dddd'), array('123', '456', '789'), array('"aaa"', '"bbb"') ); header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=\"example.csv\""); outputCSV($list); function outputCSV($data) { $outstream = fopen("php://output", 'w'); echo "sep=;\n"; function __outputCSV(&$vals, $key, $filehandler) { fputcsv($filehandler, $vals, ';', '"'); } array_walk($data, '__outputCSV', $outstream); fclose($outstream); } } ?>
Output for 4.3.0 - 7.1.0