Filesystem
Table of Contents
Classes
- PathInfo
- Provides information about a file path.
Functions
- filename() : string
- Returns the name component of path without the extension.
- extension() : string
- Returns the extension component of path without the extension.
Functions
filename()
Returns the name component of path without the extension.
filename(string $path[, string $suffix = '' ]) : string
Given a string containing the path to a file or directory, this function will return the trailing name component without the extension.
Note:
If the path has more than one extension, filename() only strips the last one.
Note:
filename() operates naively on the input string, and is not aware of the actual filesystem, or path components such as "..".
Caution filename() is locale aware, so for it to parse a path containing multibyte characters correctly, the matching locale must be set using the setlocale() function.
See Also
- dirname() - Returns a parent directory's path
- basename() - Returns trailing name component of path
- extension() - Returns extension component of path
- pathinfo() - Returns information about a file path
Parameters
- $path : string
-
A path.
- $suffix : string = ''
-
If the name component ends in suffix this will also be cut off.
Return values
stringextension()
Returns the extension component of path without the extension.
extension(string $path) : string
Given a string containing the path to a file or directory, this function will return the extension component.
Note:
If the path has more than one extension extension() returns only the last one.
Note:
extension() operates naively on the input string, and is not aware of the actual filesystem, or path components such as "..".
Caution extension() is locale aware, so for it to parse a path containing multibyte characters correctly, the matching locale must be set using the setlocale() function.
See Also
- dirname() - Returns a parent directory's path
- basename() - Returns trailing name component of path
- filename() - Returns basename of path, without extension
- pathinfo() - Returns information about a file path
Parameters
- $path : string
-
A path.