function Path::getExtension
Returns the extension from a file path (without leading dot).
Parameters
bool $forceLowerCase forces the extension to be lower-case:
2 calls to Path::getExtension()
- Path::changeExtension in vendor/
symfony/ filesystem/ Path.php - Changes the extension of a path string.
- Path::hasExtension in vendor/
symfony/ filesystem/ Path.php - Returns whether the path has an (or the specified) extension.
File
-
vendor/
symfony/ filesystem/ Path.php, line 276
Class
- Path
- Contains utility methods for handling path strings.
Namespace
Symfony\Component\FilesystemCode
public static function getExtension(string $path, bool $forceLowerCase = false) : string {
if ('' === $path) {
return '';
}
$extension = pathinfo($path, \PATHINFO_EXTENSION);
if ($forceLowerCase) {
$extension = self::toLower($extension);
}
return $extension;
}