What are the recommended PHP functions for opening, writing to, and closing a file?

To open, write to, and close a file in PHP, you can use the `fopen()`, `fwrite()`, and `fclose()` functions respectively. First, use `fopen()` to open a file in the desired mode (e.g., 'w' for writing). Then, use `fwrite()` to write data to the file. Finally, use `fclose()` to close the file and free up system resources.

$file = fopen("example.txt", "w");
fwrite($file, "Hello, world!");
fclose($file);