The What
Syntax
mixed pathinfo ( string $path [, string $specific_element ] );
Description
When you need information about a file’s path, you use pathinfo
. You give it the path that you want to check. If you specify the element you want back, then it returns just that element in a string; else it returns an associative array that contains the following elements:
- dirname
- basename
- extension (if any)
- filename
Parameters
pathinfo
- The path to be evaluated and parsed.
specific_element
- optional The specific element you want to receive back instead of the entire associative array. If you want this option, then pass in one of these constants:
PATHINFO_DIRNAME
,PATHINFO_BASENAME
,PATHINFO_EXTENSION
,PATHINFO_FILENAME
.
Return Values
Returns a string for the specific element you requested or, if none is requested, then you get an associative array back.
Your best friend is code, Tonya is making the introductions.
More coming soon…keep checking back.