PHP basename() Function
Complete PHP Filesystem Reference Manual
Definition and Usage
The basename() function returns the file name part of a path.
Syntax
basename(path,suffix)
| Parameters | Description |
|---|---|
| path | Required. Specifies the path to check. |
| suffix | Optional. Specifies a file extension. If the file has that file extension, it will not be shown. |
Example
"; //Show filename without file extension echo basename($path,".php"); ?>The code above will output:
home.php
home
Complete PHP Filesystem Reference Manual