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
  • alias for fwrite fputs

    fputs

    aliasforfwrite
  • Copy the file copy

    copy

    Copythefile
  • Delete directory rmdir

    rmdir

    Deletedirectory
  • Create a new directory mkdir

    mkdir

    Createanewdirectory
  • Read a line from the file pointer and parse the CSV field fgetcsv

    fgetcsv

    Readalinefromthefile
  • Get file modification time filemtime

    filemtime

    Getfilemodificationt
  • Obtain file permissions fileperms

    fileperms

    Obtainfilepermission
  • Match file names with pattern fnmatch

    fnmatch

    Matchfilenameswithpa
Popular Articles