← All built-ins / dirname()
dirname()
dirname(string $s): string
Parameters
| Name | Type | Description |
|---|---|---|
| $path | string | file path |
Return value
The directory part of the path.
Example
echo dirname("/var/www/index.hphp"), "
";
echo dirname("script.hphp"), "
";/var/www .