filetype

Gets file type

&reftitle.description; ``string``false```filetype` `string` `filename`

Returns the type of the given file.

&reftitle.parameters;

`filename`

- Path to the file.

&reftitle.returnvalues;

Returns the type of the file. Possible values are fifo, char, dir, block, link, file, socket and unknown.

Returns &false; if an error occurs. `filetype` will also produce an `E_NOTICE` message if the stat call fails or if the file type is unknown.

&reftitle.errors; &fs.emits.warning.on.failure;
&reftitle.examples;

### `filetype` example

    <?php

    echo filetype('/etc/passwd');
    echo "\n";
    echo filetype('/etc/');

    ?>

&example.outputs;

    file
    dir

&reftitle.notes; ¬e.clearstatcache; &tip.fopen-wrapper.stat;
&reftitle.seealso;

- `is_dir`
- `is_file`
- `is_link`
- `file_exists`
- `mime_content_type`
- `pathinfo`
- `stat`