I have the following PHP code that shows the mime type of an uploaded file.
From PHP Mimetype introduction:
This extension has been deprecated as the PECL extension Fileinfo provides the same functionality (and more) in a much cleaner way.
The functions in this module try to guess the content type and encoding of a file by looking for certain magic byte sequences at specific positions within the file. While this is not a bullet proof approach the heuristics used do a very good job.
This extension is derived from Apache mod_mime_magic, which is itself based on the file command maintained by Ian F. Darwin. See the source code for further historic and copyright information.
From PHP Fileinfo introduction:
The functions in this module try to guess the content type and encoding of a file by looking for certain magic byte sequences at specific positions within the file. While this is not a bullet proof approach the heuristics used do a very good job.
Here's a question with some answers on the same subject: Detecting MIME type in PHP.
I don't have a Unix box here to inspect a real "magic" file (the signatures database used to guess mime types) but a quick Google search revealed this:
# $File: fortran,v 1.6 2009/09/19 16:28:09 christos Exp $
# FORTRAN source
0 regex/100 \^[Cc][\ \t] FORTRAN program
!:mime text/x-fortran
Apparently, it scans the start of the file looking for lines that begin with a single C letter plus spaces, which seem to be a Fortran style comment. Thus the false positive:
somecolumn;
C F;