← All built-ins / basename()
basename()
basename(...$args): string
Parameters
| Name | Type | Description |
|---|---|---|
| $path | string | file path |
| $suffix | string | stripped from the end when presentoptional |
Return value
The file name part of the path.
Example
echo basename("/var/www/index.hphp"), "
";
echo basename("page.html", ".html"), "
";index.hphp page