Current Location: Home> Function Categories> filetype

filetype

Get file type
Name:filetype
Category:File system
Programming Language:php
One-line Description:Returns the file type.

Definition and usage

filetype() function returns the type of the specified file or directory.

If successful, 7 possible values ​​are returned. If it fails, return false.

Possible values:

  • fifo
  • char
  • dir
  • Block
  • link
  • file
  • unknown

Example

Example 1

 <?php
echo filetype ( "test.txt" ) ;
?>

Output:

 file

Example 2

 <?php
echo filetype ( "images" ) ;
?>

Output:

 dir

grammar

 filetype ( filename )
parameter describe
filename Required. Specify documents to be inspected.
Similar Functions
  • Get file modification time filemtime

    filemtime

    Getfilemodificationt
  • Read files (safely used in binary files) fread

    fread

    Readfiles(safelyused
  • Get file information through the opened file pointer fstat

    fstat

    Getfileinformationth
  • Match file names with pattern fnmatch

    fnmatch

    Matchfilenameswithpa
  • Obtain file permissions fileperms

    fileperms

    Obtainfilepermission
  • Returns the file path information pathinfo

    pathinfo

    Returnsthefilepathin
  • Rewind the file pointer position rewind

    rewind

    Rewindthefilepointer
  • Create a file with a unique file name tempnam

    tempnam

    Createafilewithauniq
Popular Articles