Menu Home

fstat

osbo.com | PHP | Functions | 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] => 64772
    [1] => 1447148
    [2] => 33188
    [3] => 1
    [4] => 5049833
    [5] => 5049833
    [6] => 0
    [7] => 5
    [8] => 1618853637
    [9] => 1618714273
    [10] => 1618714273
    [11] => 4096
    [12] => 8
    [dev] => 64772
    [ino] => 1447148
    [mode] => 33188
    [nlink] => 1
    [uid] => 5049833
    [gid] => 5049833
    [rdev] => 0
    [size] => 5
    [atime] => 1618853637
    [mtime] => 1618714273
    [ctime] => 1618714273
    [blksize] => 4096
    [blocks] => 8
)

PHP