php – How to know if there is already a file not to write?

I am a beginner, what I do is a form that is saved in a .txt document. The problem is that when you save, it does not know if it already exists with that name or not and if you put the same name, it is written above the one that already existed. , can you help me please?