mime_content_type

Supported Versions: PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
Detect MIME Content-type for a file
mime_content_type(resource|string $filename): string|false
        $this->assertSame(20$info[1]);

        
$this->assertSame(

            
'image/jpeg',

            
mime_content_type($jpg->getRealPath())

        );

    }
        $this->assertSame(

            
'image/gif',

            
mime_content_type($image->getRealPath())

        );

    }
        $this->assertSame(

            
'image/webp',

            
mime_content_type($image->getRealPath())

        );

    }
        $imagePath $image->getRealPath();



        
$this->assertSame('image/x-ms-bmp'mime_content_type($imagePath));



        
$this->assertSame('image/bmp'getimagesize($imagePath)['mime']);

    }