title: How can I overwrite file contents with new content in PHP?
body: <p>I tried to use fopen, but I only managed to append content to end of file. Is it possible to overwrite all contents with new content in PHP?</p>