What is the significance of using "a" or "r" in the fopen function when working with files in PHP?

When using the `fopen` function in PHP to work with files, the mode parameter specifies how the file should be opened. The "r" mode opens the file for reading only, while the "a" mode opens the file for writing only, starting at the end of the file if it exists. It is important to choose the correct mode based on whether you need to read from or write to the file.

// Example of opening a file for reading
$file = fopen("example.txt", "r");

// Example of opening a file for writing
$file = fopen("example.txt", "a");