What parameters in the fopen function determine if a file will be overwritten in PHP?

When using the fopen function in PHP, the parameter that determines whether a file will be overwritten is the mode parameter. If the mode is set to "w" or "w+", it will open the file for writing and truncate the file to zero length if it already exists, effectively overwriting its contents. To avoid overwriting the file, you can use modes like "a" or "a+" for appending data to the end of the file without truncating it.

$file = fopen("example.txt", "a"); // Opens the file for writing without overwriting its contents
// Write to the file or perform other operations
fclose($file); // Close the file when done