Copyright © tutorialspoint.com
| string dirname ( string $path ); |
Given a string containing a path to a file, this function will return the name of the directory.
| Parameter | Description |
|---|---|
| path | A file path. |
Returns the base name of the given path.
Following is the usage of this function:
<?php $path = "/home/httpd/html/index.php"; $dir = dirname($path); echo "dirname is $dir\n"; ?> |
This will produce following result:
dirname is /home/httpd/html |
Copyright © tutorialspoint.com