Jump to: navigation, search

Php fstat

From w3cyberlearnings

Contents

PHP function fstat

This function gets information about a file statistic.

Syntax fstat

a file pointer that it created using fopen().

fstat(file);

Return

Returns a file statistics in array format.

Example 1

<?php

// open a file
$fh = fopen("myfile.txt", "r");

// gather statistics
$fstat = fstat($fh);

// close the file
fclose($fh);

// print file information
print_r($fstat);

// get only associative array part
// print_r(array_slice($fstat, 13));

?>

Output


Array
(
    [0] => 0
    [1] => 0
    [2] => 33206
    [3] => 1
    [4] => 0
    [5] => 0
    [6] => 0
    [7] => 108
    [8] => 1339300834
    [9] => 1339300834
    [10] => 1339300834
    [11] => -1
    [12] => -1
    [dev] => 0
    [ino] => 0
    [mode] => 33206
    [nlink] => 1
    [uid] => 0
    [gid] => 0
    [rdev] => 0
    [size] => 108
    [atime] => 1339300834
    [mtime] => 1339300834
    [ctime] => 1339300834
    [blksize] => -1
    [blocks] => -1
)

Related Links


basename-- chgrp-- chmod-- chown-- clearstatcache-- copy-- delete-- dirname-- disk_free_space-- disk_total_space-- diskfreespace-- fclose-- feof-- fflush-- fgetc-- fgetcsv-- fgets-- fgetss-- file_exists-- file_get_contents-- file_put_contents- file-- fileatime-- filectime-- filegroup-- fileinode-- filemtime-- fileowner-- fileperms-- filesize-- filetype-- flock-- fnmatch-- fopen-- fpassthru-- fputcsv-- fputs-- fread-- fscanf-- fseek-- fstat-- ftell-- ftruncate-- fwrite-- glob-- is_dir-- is_executable-- is_file-- is_link-- is_readable-- is_uploaded_file-- is_writable-- is_writeable-- lchgrp-- lchown-- link-- linkinfo-- lstat-- mkdir-- move_uploaded_file-- parse_ini_file-- parse_ini_string-- pathinfo-- pclose-- popen-- readfile-- readlink-- realpath_cache_get-- realpath_cache_size-- realpath-- rename-- rewind-- rmdir-- set_file_buffer-- stat-- symlink-- tempnam-- tmpfile-- touch-- umask-- unlink--

Navigation
Web
SQL
MISC
References