← All docs

dirname()

Returns a parent directory's path.

dirname()

function dirname(string $path, int $levels = 1): string

Returns a parent directory’s path.

Parameters:

  • $path (string)
  • $levels (int), default 1, optional

Returns: string

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

Internals

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