What functions can be used in PHP to open, write to, read from, and close files?

To open, write to, read from, and close files in PHP, you can use the following functions: 1. fopen() - to open a file 2. fwrite() - to write to a file 3. fread() - to read from a file 4. fclose() - to close a file Here is a PHP code snippet that demonstrates how to use these functions:

<?php
// Open a file for writing
$file = fopen("example.txt", "w");

// Write to the file
fwrite($file, "Hello, World!");

// Close the file
fclose($file);

// Open the file for reading
$file = fopen("example.txt", "r");

// Read from the file
echo fread($file, filesize("example.txt"));

// Close the file
fclose($file);
?>