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?