spillage Posted May 9, 2008 Share Posted May 9, 2008 Ok Heres my question. I know how to write to a file using somthing like $output= $data."\t".$data1."\t" etc; But after searching everywhere cannot get my head around using this with and array. It probally me just been a noobie but and help would be appreciated. Cheers, Spill Link to comment https://forums.phpfreaks.com/topic/104840-write-an-array-to-file/ Share on other sites More sharing options...
mraiur Posted May 9, 2008 Share Posted May 9, 2008 If you need to read the file to an array use "file()". and then search the array ... Link to comment https://forums.phpfreaks.com/topic/104840-write-an-array-to-file/#findComment-536613 Share on other sites More sharing options...
thedarkwinter Posted May 9, 2008 Share Posted May 9, 2008 you can use implode to convert the array to string (csv?) $output = implode(",", $myarray); hope that helps cheers, tdw Link to comment https://forums.phpfreaks.com/topic/104840-write-an-array-to-file/#findComment-536615 Share on other sites More sharing options...
spillage Posted May 9, 2008 Author Share Posted May 9, 2008 Thanks both for replying. The array has been created from a mysql query that is also been shown in a table. I think I need to sit down and have a good look around as not to sure if the $row in the table is the array??? Also have 3 else if outputs for html tables so the file written from each of these would be diffrent and need to have the fwrite() nestled in each of these as another if statement depending on if I choose to view table and write to file. Does any of this make sense? Cheers, Spill. Link to comment https://forums.phpfreaks.com/topic/104840-write-an-array-to-file/#findComment-536653 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.