Menu Riverview Church

DIRNAME

Returns a parent directory's path

SYNTAX

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

PARAMETERS

path

A path.

On Windows, both slash (/) and backslash (\) are used as directory separator character. In other environments, it is the forward slash (/).

levels

The number of parent directories to go up.

This must be an integer greater than 0.

RETURN

Returns the path of a parent directory. If there are no slashes in path, a dot ('.') is returned, indicating the current directory. Otherwise, the returned string is path with any trailing /component removed.

EXAMPLES

PATH

/etc
/etc
/etc
/
.
.

LEVELS

/usr/local
/usr

PHP