PHP filetype() Function

PHP filetype Function


Definition :

The PHP filetype() function returns the type of the specified file.

Note: The results of this function are cached. Use clearstatcache() function to clear the cache.

Possible return values:

  • fifo
  • char
  • dir
  • block
  • link
  • file
  • socket
  • unknown
Syntax

    filetype(filename)

Parameter 
Parameter Description
filename Required. Specifies the file to check

Given below example Return the file type for "demo.txt":

Output :  file type: file
                file type: dir
                file type: dir