What are some alternative methods or functions to determine the mime type of a file in PHP?

When working with file uploads in PHP, it is important to determine the mime type of the uploaded file to ensure its validity and security. One common method to determine the mime type is using the `finfo_file()` function, which is part of the Fileinfo extension. However, if the Fileinfo extension is not available or enabled on your server, you can use other methods such as checking the file extension or using the `mime_content_type()` function.

// Using finfo_file() function
if (function_exists('finfo_open')) {
    $finfo = finfo_open(FILEINFO_MIME_TYPE);
    $mime_type = finfo_file($finfo, $file_path);
    finfo_close($finfo);
    echo "Mime type: " . $mime_type;
} else {
    // Using mime_content_type() function as fallback
    $mime_type = mime_content_type($file_path);
    echo "Mime type: " . $mime_type;
}