Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP filetype() Function

PHP filetype() Function


PHP Filesystem Reference Manual 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:

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


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual