PHP function pathinfo()

Availability in versions: PHP 4.0.3

Returns information about a file path

Parameters

Parameter Data type Default value Note
$path string not The path being checked.
$options int null 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.

Return values

mixed

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

If options is used, this function will return a string if not all elements are requested.

Other resources

Official pathinfo documentation

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.