What is the recommended PHP function for handling file operations like creation and editing?

When handling file operations like creation and editing in PHP, the recommended function is `file_put_contents()`. This function allows you to write data to a file, creating the file if it does not exist or overwriting it if it does. It simplifies the process of writing to files and is a more concise alternative to using `fopen`, `fwrite`, and `fclose` functions.

// Example of using file_put_contents() to create or edit a file
$file = 'example.txt';
$data = 'Hello, world!';

file_put_contents($file, $data);