Forum Moderators: coopster

Message Too Old, No Replies

export array values to csv?

         

PHPycho

8:57 am on Jun 4, 2007 (gmt 0)

10+ Year Member



Hello forums!
i would like to know how to export the data in .csv format?
suppose i had an array holding values:
[PHP]$data_arr[$i][0] = "xx";
$data_arr[$i][0] = "xx";
$data_arr[$i][0] = "xx";
$data_arr[$i][0] = "xx";[/PHP]
where $i varies from 0 to n

I would like to export this data in .csv format,
how could this be accomplished?
Thanks in advance to all of you

eelixduppy

1:13 pm on Jun 4, 2007 (gmt 0)



You just have to implode [php.net] the array into a string (separated by a comma, of course), and fwrite [php.net] it to the .csv file.

To get the info back from the string, you can explode [php.net] it. :)