How can PHP be used to verify if an uploaded file is truly an image file?

To verify if an uploaded file is truly an image file in PHP, you can use the `getimagesize()` function which returns an array containing information about the image. You can then check the returned data to ensure it is a valid image file based on the MIME type or image dimensions.

// Check if the uploaded file is an image
if(isset($_FILES['file']['tmp_name'])){
    $image_info = getimagesize($_FILES['file']['tmp_name']);
    if($image_info !== false) {
        echo "File is an image - " . $image_info['mime'] . ".";
    } else {
        echo "File is not an image.";
    }
}