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 Quote Link to comment 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); Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.