Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP dirname() Function

PHP dirname() Function


PHP Filesystem Reference Manual 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.

Example

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

The code above will output:

c:/testweb

/testweb


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual