dirname

dirname

(PHP 4, PHP 5, PHP 7)

dirnameReturns a parent directory's path

Description

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

Given a string containing the path of a file or directory, this function will return the parent directory's path that is levels up from the current directory.

Note:

dirname() operates naively on the input string, and is not aware of the actual filesystem, or path components such as "..".