public function isAcceptable($mimeType, array $acceptable) {
        foreach ($acceptable as $type => $q) {
            $pattern = '#^' . str_replace('*', '.*', $type) . '#';

            if (preg_match($pattern, $mimeType)) {
                return $q;
            }
        }

        return false;
    }
public function isAcceptable($mimeType, array $acceptable) {
        foreach ($acceptable as $type => $q) {
            $pattern = '#^' . str_replace('*', '.*', $type) . '#';

            if (preg_match($pattern, $mimeType)) {
                return $q;
            }
        }

        return false;
    }
public function isAcceptable ( $ mimeType , array $ acceptable ) { foreach ( $ acceptable as $ type => $ q ) { $ pattern = '#^' . str_replace ( '*' , '.*' , $ type ) . '#' ; if ( preg_match ( $ pattern , $ mimeType ) ) { return $ q ; } } return false ; }
See if a mime type is accepted

@param string $mimeType The mime type to check, for instance "image/png"
@param array $acceptable An array of acceptable content types as keys and the quality as
value
@return boolean|double Returns the quality of the mime type if it is accepted, or false
otherwise
See if a mime type is accepted