Jump to content

Line Break Problem in .txt file


habib009pk

Recommended Posts

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

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);

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.