3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $list = array ( array('aaa,', 'bbb', 'ccc', 'dddd'), array('123', '456', '789'), array('"aaa"', '"bbb"') ); $fp = fopen('/tmp/file.csv', 'w'); foreach ($list as $fields) { fputcsv($fp, $fields); } fclose($fp); echo file_get_contents('/tmp/file.csv');
based on WT0lN
Output for 5.1.0 - 5.2.1, 5.2.3 - 5.3.20, 5.3.22 - 5.5.12, 5.5.14 - 7.3.1
"aaa,",bbb,ccc,dddd 123,456,789 """aaa""","""bbb"""
Output for 5.2.2, 5.3.21, 5.5.13
Warning: file_get_contents(/tmp/file.csv): failed to open stream: No such file or directory in /in/dJaBF on line 15
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function fputcsv() in /in/dJaBF on line 11
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: fputcsv() in /in/dJaBF on line 11
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: fputcsv() in /in/dJaBF on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: fputcsv() in /in/dJaBF on line 11