fstat

Gets information about a file using an open file pointer

Syntax

fstat ( resource $handle ) : array

Parameters

handle

A file system pointer resource that is typically created using fopen().

Return

Returns an array with the statistics of the file; the format of the array is described in detail on the stat() manual page.

Examples

<?

$filename = $_SERVER["DOCUMENT_ROOT"]. "/assets/txt/file.txt";
$mode = "r";

$handle = fopen($filename, $mode);

    $return = fstat($handle);

    print_r($return);

fclose($handle);

?>
Array
(
    [0] => 2065
    [1] => 149553170
    [2] => 33188
    [3] => 1
    [4] => 1175
    [5] => 1180
    [6] => 0
    [7] => 5
    [8] => 1631588475
    [9] => 1634717008
    [10] => 1634717008
    [11] => 4096
    [12] => 8
    [dev] => 2065
    [ino] => 149553170
    [mode] => 33188
    [nlink] => 1
    [uid] => 1175
    [gid] => 1180
    [rdev] => 0
    [size] => 5
    [atime] => 1631588475
    [mtime] => 1634717008
    [ctime] => 1634717008
    [blksize] => 4096
    [blocks] => 8
)

PHP

Home Menu