Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need syntax for str_replace to replace line breaks in a text file 1

Status
Not open for further replies.

jewel464g

Technical User
Jul 18, 2001
198
US
Need syntax for str_replace to replace line breaks in a text file with <BR>

I'm using a Linux machine as a server and I'm reading a log file in, I want to display this as a web page, with proper formatting. I have everything working except for the line breaks, can someone tell me the syntax to use. Thanks a lot.

Jewel
 
echo nl2br(implode(&quot;&quot;,file(&quot;filename.txt&quot;)));


you have the func nl2br that changes all the new line by <br>.

Note: if you apply nl2br to a string with tables in the middle, it will not work cause the <br> in the end of lines are going to be written in the outside and the table is going far bottom in the text leaving blank spaces in the text. Anikin
Hugo Alexandre Dias
Web-Programmer
anikin_jedi@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top