pathinfoReturns information about a file path
&reftitle.description;
mixedpathinfostringpathintoptionsPATHINFO_DIRNAME | PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAMEpathinfo returns information about
path: either an associative array or a string,
depending on options.
&reftitle.parameters;
path
The path to be parsed.
options
If present, specifies a specific element to be returned; one of
PATHINFO_DIRNAME,
PATHINFO_BASENAME,
PATHINFO_EXTENSION or
PATHINFO_FILENAME.
If options is not specified, returns all
available elements.
&reftitle.returnvalues;
If the options parameter is not passed, an
associative array containing the following elements is
returned:
dirname, basename,
extension (if any), and filename.
If the path does not have an extension, no
extension element will be returned
(see second example below).
If options is present, returns a
string containing the requested element.
&reftitle.changelog;
&Version;&Description;5.2.0
The PATHINFO_FILENAME constant was added.
&reftitle.examples;
pathinfo Example
]]>
&example.outputs;
pathinfo example showing difference between null and no extension
]]>
&example.outputs.similar;
&reftitle.notes;
For information on retrieving the current path info, read
the section on
predefined reserved variables.
pathinfo is locale aware, so for it to parse a path
containing multibyte characters correctly, the matching locale must be set using
the setlocale function.
&reftitle.seealso;
dirnamebasenameparse_urlrealpath