PHP – Reading from a file into a HTML table

As I have already mentioned in a previous article here, lately PHP has attracted my attention. Thus, today I will show how to build a small HTML table from a txt file, using each line in the file as a different row. Something like this:

readingLet’s see what do we need? A file to read and free time to write 31 lines of code. Not much, eh?

Actually, we check whether the file we need actually exists, can we open it and if the answer is yes – we create a table with a row for each line of the file.

Beautiful in its own way. Here comes the code:

Enjoy it!

Tagged with: , ,