Home > PHP > Function > Filesystem > pathinfo()

pathinfo()

pathinfo - Returns information about a file path

Syntax

mixed pathinfo (string $path, int $options)

Arguments

  • path - The path being checked.
  • options - You can specify which elements are returned with optional parameter options. It composes from PATHINFO_DIRNAME, PATHINFO_BASENAME, PATHINFO_EXTENSION and PATHINFO_FILENAME. It defaults to return all elements.

Description

pathinfo() returns an associative array containing information about path.

Version

PHP 4.0.3, 5

Return value

The following associative array elements are returned: dirname, basename, extension(if any), and filename.