PHP | SplFileObject fstat() Function
The SplFileObject::fstat() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to give the information of the file.
Syntax:
array SplFileObject::fstat( void )
Parameters: This function does not accept any parameter.
Return values: This function returns an array which contains details of the file.
Below Programs illustrate the SplFileObject::fstat() function in PHP:
Program 1:
<?php // Create an SplFile Object $gfg = new SplFileObject("gfg.txt", "r"); $stat = $gfg->fstat(); // Print result print_r($stat); ?> |
Output:
Array
(
[dev] => 771
[ino] => 488704
[mode] => 33188
[nlink] => 1
[uid] => 0
[gid] => 0
[rdev] => 0
[size] => 1114
[atime] => 1061067181
[mtime] => 1056136526
[ctime] => 1056136526
[blksize] => 4096
[blocks] => 8
)
Program 2: PHP program to give the information of the current file.
<?php // Create Spl Object $gfg = new SplFileObject(__FILE__, "r"); $stat = $gfg->fstat(); // Print result print_r($stat); ?> |
Output:
Array
(
[dev] => 771
[ino] => 488704
[mode] => 33188
[nlink] => 1
[uid] => 0
[gid] => 0
[rdev] => 0
[size] => 1114
[atime] => 1061067181
[mtime] => 1056136526
[ctime] => 1056136526
[blksize] => 4096
[blocks] => 8
)
Reference: http://php.net/manual/en/splfileobject.fstat.php
Recommended Posts:
- PHP | fstat( ) Function
- PHP | SplFileObject eof() Function
- PHP | SplFileObject setMaxLineLen() Function
- PHP | SplFileObject flock() Function
- PHP | SplFileObject ftruncate() Function
- PHP | SplFileObject fwrite() Function
- PHP | SplFileObject fgetc() Function
- PHP | SplFileObject fgets() Function
- PHP | SplFileObject fgetss() Function
- PHP | SplFileObject current( ) Function
- PHP | SplFileObject getMaxLineLen() Function
- PHP | SplFileObject fputcsv() Function
- PHP | SplFileObject seek() Function
- PHP | SplFileObject rewind() Function
- PHP | SplFileObject ftell() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



