- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
fstat() function in PHP
The fstat() function returns information about an open file.
It returns an array with the below given elements −
- [0] or [dev] - Device number
- [1] or [ino] - Inode number
- [2] or [mode] - Inode protection mode
- [3] or [nlink] - Number of links
- [4] or [uid] - User ID of owner
- [5] or [gid] - Group ID of owner
- [6] or [rdev] - Inode device type
- [7] or [size] - Size in bytes
- [8] or [atime] - Last access time as Unix timestamp
- [9] or [mtime] - Last modified time as Unix timestamp
- [10] or [ctime] - Last inode change time as Unix timestamp
- [11] or [blksize] - Blocksize of filesystem IO
- [12] or [blocks] - Number of blocks allocated
Syntax
fstat(file_pointer)
Parameters
file_pointer − A file pointer created using fopen(). Required.
Return
The fstat() function returns an array with the elements we saw above.
Example
<?php $file_pointer = fopen("one.txt", "r"); print_r(fstat($file_pointer)); fclose($file_pointer); ?>
The following is the output that shows the elements.
Output
Array ( [0] => 0 [1] => 0 [2] => 33206 [3] => 1 [4] => 0 [5] => 0 [6] => 0 [7] => 120 [8] => 1928173529 [9] => 1124185875 [10] => 1114322653 [11] => -1 [12] => -1 [dev] => 0 [ino] => 0 [mode] => 33206 [nlink] => 1 [uid] => 0 [gid] => 0 [rdev] => 0 [size] => 120 [atime] => 1928173529 [mtime] => 1124185875 [ctime] => 1114322653 [blksize] => -1 [blocks] => -1 )
Advertisements