src/Path.php
public static function getExtension($path, $forceLowerCase = false)
    {
        if ('' === $path) {
            return '';
        }

        Assert::string($path, 'The path must be a string. Got: %s');

        $extension = pathinfo($path, PATHINFO_EXTENSION);

        if ($forceLowerCase) {
            $extension = self::toLower($extension);
        }

        return $extension;
    }
public static function getExtension($path, $forceLowerCase = false)
    {
        if ('' === $path) {
            return '';
        }

        Assert::string($path, 'The path must be a string. Got: %s');

        $extension = pathinfo($path, PATHINFO_EXTENSION);

        if ($forceLowerCase) {
            $extension = self::toLower($extension);
        }

        return $extension;
    }
public static function getExtension ( $ path , $ forceLowerCase = false ) { if ( '' === $ path ) { return '' ; } Assert :: string ( $ path , 'The path must be a string. Got: %s' ) ; $ extension = pathinfo ( $ path , PATHINFO_EXTENSION ) ; if ( $ forceLowerCase ) { $ extension = self :: toLower ( $ extension ) ; } return $ extension ; }
Returns the extension from a file path.

@param string $path           The path string.
@param bool   $forceLowerCase Forces the extension to be lower-case
(requires mbstring extension for correct
multi-byte character handling in extension).

@return string The extension of the file path (without leading dot).

@since 1.1 Added method.
@since 2.0 Method now fails if $path is not a string.
Returns the extension from a file path .