habib009pk Posted August 6, 2009 Share Posted August 6, 2009 Hi Friends, I am facing a problem i want to create a file from different variables having date i.e: $cheadline or $qsummary. Now after cancatenation of these variables i have another variable that is $combine. $combine=$cheadline.'\n'.$qsummary.'\n'.$fpara.'\n'.$lsentence.'\n'.$summrize.'\n'.$cinfo; When i am using that code $handle = fopen($filename, "w"); fwrite($handle,$combine); Then file will be created but all the data are written on same line, without line break. Please help me how can i break the line after the data of each variable. Thank and Regards Link to comment https://forums.phpfreaks.com/topic/169065-line-break-problem-in-txt-file/ Share on other sites More sharing options...
habib009pk Posted August 6, 2009 Author Share Posted August 6, 2009 Thanks for you Cooperation It is solved by that code my self $seperate=" "; $string=$cheadline.$seperate.$qsummary.$seperate.$fpara.$seperate.$lsentence.$seperate.$summrize.$seperate.$cinfo.$seperate; $filename = "file.txt"; $handle = fopen($filename, "w"); fwrite($handle,$string); fclose($handle); Link to comment https://forums.phpfreaks.com/topic/169065-line-break-problem-in-txt-file/#findComment-892014 Share on other sites More sharing options...
infiniteacuity Posted August 11, 2009 Share Posted August 11, 2009 You are better off using \r\n to create line breaks within the text file. Link to comment https://forums.phpfreaks.com/topic/169065-line-break-problem-in-txt-file/#findComment-895613 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.