1// dirname ( string $path [, int $levels = 1 ] ) : string
2
3<?php
4echo dirname("/etc/passwd") . PHP_EOL;
5echo dirname("/etc/") . PHP_EOL;
6echo dirname(".") . PHP_EOL;
7echo dirname("C:\\") . PHP_EOL;
8echo dirname("/usr/local/lib", 2);
9
10// Above example outputs:
11
12/*
13 "/etc"
14 "/" (or "\" on Windows)
15 "."
16 "C:\"
17 "/usr"
18*/
19