Current Location: Home> Function Categories> dirname

dirname

Return to the directory part in the path
Name:dirname
Category:File system
Programming Language:php
One-line Description:Returns the directory name part in the path.

Definition and usage

dirname() function returns the directory part in the path.

Example

 <?php
echo dirname ( "c:/testweb/home.php" ) ;
echo dirname ( "/testweb/home.php" ) ;
?>

Output:

 c:/testweb
/testweb

grammar

 dirname ( path )
parameter describe
path Required. Specify the path to be checked.

illustrate

The path parameter is a string containing the full path to a file. This function returns the directory name after removing the file name.

Similar Functions
Popular Articles