src/Utilities/Miscellaneous.php
public static function getFileExtension($fileName, $asLowerCase = false)
    {
        $extension = '';
        $matches = [];

        if (preg_match('|(.+)\.(.+)|', $fileName, $matches)) {
            $extension = end($matches);
        }

        if ($asLowerCase) {
            return strtolower($extension);
        }

        return $extension;
    }
public static function getFileExtension($fileName, $asLowerCase = false)
    {
        $extension = '';
        $matches = [];

        if (preg_match('|(.+)\.(.+)|', $fileName, $matches)) {
            $extension = end($matches);
        }

        if ($asLowerCase) {
            return strtolower($extension);
        }

        return $extension;
    }
public static function getFileExtension ( $ fileName , $ asLowerCase = false ) { $ extension = '' ; $ matches = [ ] ; if ( preg_match ( '|(.+)\.(.+)|' , $ fileName , $ matches ) ) { $ extension = end ( $ matches ) ; } if ( $ asLowerCase ) { return strtolower ( $ extension ) ; } return $ extension ; }
Returns file extension

@param string $fileName    File name
@param bool   $asLowerCase (optional) if true extension is returned as lowercase string
@return string
Returns file extension