PHP basename() Function

Return filename from the specified path

Definition and Usage

The basename() function returns the filename from a path.

Syntax

basename(path, suffix)

Parameter Values

Parameter Description
path Required. Specifies a file path
suffix Optional. A file extension. If the filename has this file extension, the file extension will be cut off

Technical Details

Return Value: The filename of the specified path
PHP Version: 4.0+

❮ PHP Filesystem Reference