← All docs

basename()

Returns the trailing name component of a path.

basename()

function basename(string $path, string $suffix = ''): string

Returns the trailing name component of a path.

Parameters:

  • $path (string)
  • $suffix (string), default '', optional

Returns: string

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how basename is implemented in the compiler, see the internals page.