How can fopen and file_get_contents be used to handle JSON files in PHP?

To handle JSON files in PHP, you can use the `fopen` function to open the file and then `file_get_contents` to read the contents of the file. This allows you to manipulate the JSON data as needed within your PHP script.

// Open the JSON file
$handle = fopen('data.json', 'r');

// Read the contents of the file
$jsonData = file_get_contents('data.json');

// Decode the JSON data
$data = json_decode($jsonData, true);

// Close the file
fclose($handle);

// Now you can work with the $data array as needed