dirname — Returns a parent directory’s path
dirname(string $path, int $levels = 1): string
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.
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.
Have Feedback?Let us know how we can improve this tool.