PHP filetype() Function
Complete PHP Filesystem Reference Manual
Definition and Usage
The filetype() function returns the type of a specified file or directory.
Returns one of 7 possible values on success, or FALSE on failure.
Possible return values:
- fifo
- char
- dir
- block
- link
- file
- unknown
Syntax
filetype(filename)
| Parameters | Description |
|---|---|
| filename | Required. Specifies the file to check. |
Tips and Notes
**Note:** The results of this function are cached. Use clearstatcache() to clear the cache.
Example 1
The code above will output:
file
Example 2
The code above will output:
dir
Complete PHP Filesystem Reference Manual