Thank you very much for your help.
Can you please tell me where exactly I should put this code, I really don't understand it.
In my website I have an index.php file which reads the incoming data and then include a display.html file which displays the contents of file1.txt in a table on my website.
Should I create another file and include in this file the code you suggested me?
How this code will sit outside of my php file?