English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP Filesystem Reference Manual
The filetype() function can return the file type of a specified file or directory. If successful, this function can return one of seven possible values; if it fails, it can return false.
string filetype ( string filename )
Possible values are fifo, char, dir, block, link, file, and unknown.
If an error occurs, FALSE is returned. The filetype() function may also produce an E_NOTICE message if the stat call fails or the file type is unknown.
<?php echo filetype("/PhpProject/sample.txt"); // file echo "\n"; echo filetype("/PhpProject/"); // dir ?>Test and See‹/›
Output Result
file dir