F::extension PHP 메소드

extension() 공개 정적인 메소드

$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
리턴 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));
    }