What are the consequences of not closing a file handle in PHP after writing to it?
Leaving a file handle open after writing to it can lead to resource leaks and potential issues with file locking. It is important to always close file handles after writing to them to free up system resources and ensure proper file management.
$filename = "example.txt";
$file = fopen($filename, "w");
fwrite($file, "Hello, world!");
fclose($file);