How can PHP developers determine if a file is deletable before attempting to delete it?

PHP developers can determine if a file is deletable by using the `is_writable()` function to check if the file is writable. If the file is not writable, then it cannot be deleted. This function returns true if the file is writable and false if it is not.

$filename = 'example.txt';

if (is_writable($filename)) {
    unlink($filename);
    echo 'File deleted successfully.';
} else {
    echo 'File is not deletable.';
}