PHP dirname()Function
Complete PHP Filesystem Reference Manual
Definition and Usage
The dirname() function returns the directory name part of a path.
Syntax
dirname(path)
| Parameters | Description |
|---|---|
| path | Required. Specifies the path to check. |
Examples
<?php
echo dirname("c:/testweb/home.php") . "<br />";
echo dirname("/testweb/home.php");
?>
echo dirname("c:/testweb/home.php") . "<br />";
echo dirname("/testweb/home.php");
?>
The above code will output:
c:/testweb
/testweb
/testweb
Complete PHP Filesystem Reference Manual Other Extensions