F::extension PHP Method

extension() public static method

$extension = f::extension('test.txt'); extension is txt
public static extension ( string $file, string $extension = false ) : string
$file string The filename or path
$extension string Set an optional extension to overwrite the current one
return string
    public static function extension($file, $extension = false)
    {
        // overwrite the current extension
        if ($extension !== false) {
            return static::name($file) . '.' . $extension;
        }
        // return the current extension
        return strtolower(pathinfo($file, PATHINFO_EXTENSION));
    }