The filetype()
function is a built-in function in PHP that returns the file type of a given file.
filetype(filename)
filename
: A required parameter that refers to the filename for which we want to check the file type.
This method returns the file type from the following list of values:
file
: regular filedir
: directorychar
: character special devicelink
: symbolic linkfifo
: FIFO (named pipe)block
: block special deviceunknown
: unknown file typeLet’s look at a coded example of this function:
<?php// text fileecho filetype("hello.txt");?>
Free Resources