How to output text file with line breaks in PHP?

To convert the plain text line breaks to html line breaks, try this:

$fh = fopen("filename.txt", 'r');
$pageText = fread($fh, 25000);
echo nl2br($pageText);

Note: the nl2br function wraps the text.


Popular posts from this blog

About 12 Alwars

Post thumbnails from external URLs don’t appear in Blogger. How to resolve?

What is the unicode character for the close symbol?

ஸ்தல விசேஷம் - திருக்கோவிலூர் திவ்யதேசம்