text file output not showing line breaks


I’m trying to use the below code as an include for external text files. As such this is just normal paragraphs of text.

$filename = 'content.txt';
$fp = fopen($filename, "r");
$contents = fread($fp, filesize($filename));
echo $contents;

My content.txt file (I used windows notepad looks like)

But for some reason, my output doesn’t have any line breaks. Instead it look like :

Line1 line2 line3 line4

Where am I going wrong?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

change echo $contents;

$contents = nl2br($contents);
echo $contents;



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fazsonetAuthor Commented:
That was simple enough, although I couldn't seem to find it on the web somehow....
if you want to read up on it a bit more, i suggest you go to www.php.net/nl2br


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.