severndigital Posted October 29, 2010 Share Posted October 29, 2010 ok .. so I have this object and I want to make a tab delimited text file from it. here's what I have so far. function create_tab_file_from_object($the_object) { $string = ''; foreach($the_object as $val) { $string .= $val.'\t'; } //drop last tab $string = substr($string,0,-2); filename = 'test_file_pickup.txt'; $fp = fopen('/filepath/'.$filename,'w'); fwrite($fp,$string); fclose($fp); } when i run this i get a text file that looks something like this field1\tfield2\tfield3\t ... and so on. How do I get php to make an actual tab delimited file I can open in notepad or excel or whatever.. Thanks in advance, C Link to comment https://forums.phpfreaks.com/topic/217232-make-a-tab-delimited-file-from-array-or-object/ Share on other sites More sharing options...
severndigital Posted October 29, 2010 Author Share Posted October 29, 2010 DANG .. I ALWAYS SOLVED THESE 3 SECONDS AFTER POSTING .. it was my '\t' instead of "\t" Link to comment https://forums.phpfreaks.com/topic/217232-make-a-tab-delimited-file-from-array-or-object/#findComment-1128113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.