How can the file type of a file be determined in PHP?
To determine the file type of a file in PHP, you can use the `finfo_file()` function which returns the MIME type of a file. This function requires the file path as an argument and can be used to identify the type of file based on its content.
$file_path = 'path/to/your/file.jpg';
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$file_type = finfo_file($finfo, $file_path);
finfo_close($finfo);
echo "The file type is: " . $file_type;