refiking Posted September 26, 2009 Share Posted September 26, 2009 What I did was create an array of arrays and I need to enter each array as a row in a csv file. How can I go about doing that? It looks like this: $filename = 'export.csv'; $csv = array($allarrays); print_r($csv); // Looks like this: Array ( [0] => array("1","2"), array("6","2"), array("19,"5")) Link to comment https://forums.phpfreaks.com/topic/175582-solved-create-a-csv-from-array/ Share on other sites More sharing options...
redarrow Posted September 26, 2009 Share Posted September 26, 2009 read this please fgetcsv might help? http://uk2.php.net/manual/en/function.fgetcsv.php Link to comment https://forums.phpfreaks.com/topic/175582-solved-create-a-csv-from-array/#findComment-925235 Share on other sites More sharing options...
refiking Posted September 26, 2009 Author Share Posted September 26, 2009 I don't need to read a csv file. I need to create one. Link to comment https://forums.phpfreaks.com/topic/175582-solved-create-a-csv-from-array/#findComment-925241 Share on other sites More sharing options...
redarrow Posted September 26, 2009 Share Posted September 26, 2009 normal way. now add your array info? <?php $myFile = "testFile.csv"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "one, two, three, four"; fwrite($fh, $stringData); fclose($fh); ?> Link to comment https://forums.phpfreaks.com/topic/175582-solved-create-a-csv-from-array/#findComment-925244 Share on other sites More sharing options...
Philip Posted September 26, 2009 Share Posted September 26, 2009 read this please fgetcsv might help? http://uk2.php.net/manual/en/function.fgetcsv.php Close.... fputcsv Link to comment https://forums.phpfreaks.com/topic/175582-solved-create-a-csv-from-array/#findComment-925253 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.