pathinfo
Returns information about a file path including directory, basename, extension, and filename.
Parameters
main.php
Return Values
array|string
Returns path information as array or string depending on flags
On success:Array with dirname, basename, extension, filename or specific component
On failure:Empty values for missing components
Notes
- Does not validate if the file actually exists
- Works with both local paths and URLs
- Use specific flags to get only needed components
- Essential for file upload and processing systems
Changelog
- 5.2.0: PATHINFO_FILENAME constant added
Related Functions
file_get_contents
File SystemReads entire file into a string. This is the preferred way to read the contents of a file into a string.
filereadhttp
file_put_contents
File SystemWrites data to a file. This is the preferred way to write data to a file as it handles opening, writing, and closing automatically.
writefilesave