getBaseFileName.php
Table of Contents
Functions
- getBaseFileName() : string
- Returns the base file name without its extension from a given file path.
Functions
getBaseFileName()
Returns the base file name without its extension from a given file path.
getBaseFileName(string $file[, array<string|int, mixed>|null $multiplePartExtensions = null ]) : string
This function extracts the file name from a full path and removes its extension.
It supports both single and multi-part extensions (e.g. .tar.gz
, .blade.php
).
Parameters
- $file : string
-
The full path to the file (e.g. '/path/to/archive.tar.gz').
- $multiplePartExtensions : array<string|int, mixed>|null = null
-
Optional list of multi-part extensions to consider (e.g. ['.tar.gz', '.blade.php']). If null, the method defaults to FileExtension::getMultiplePartExtensions().
Tags
Return values
string —The file name without its extension (e.g. 'archive' for 'archive.tar.gz').