Simple PHP script to read txt files and output as html

Since 000webhost blocks text files for security reasons, I have decide to post this simple php script that will read txt files and output as html. It’s also a good script to use if you manage a few websites that share common data such as contact info, links, etc. You then only have to edit one text file for “global” changes.

Might have to chmod txt file, I use 777.

 $content = file("file.txt");
  $data = implode("<br>",$content);
 echo $data;

just 1 question, im very new to php so how exactly do i put this code up? i copied it and pasted it in a new page and saved it as filename.php and uploaded it in the same folder as my .txt file so i want to know what im doing wrong. does it has something to do with .htacess? i dont know a thing of that .htacess thing. can you please help me put your code in my site?

[]Could you post your code?
]I recommend you download XAMPP at: and do all php coding on your home computer. Then upload to 000webhost.

oh nvm it worked now, the problem was that i tried another script that deleted the txt file instead of read it so i reuploaded it and your script worked perfect, thanks.

Thanks lenwhistler, this script help me a lot.

thank you, useful code, I was looking for it long time.

Thank you. Seems simpler than I thought it would be.