PHP | SplFileObject fstat() Function Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report 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 <?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 <?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: https://www.php.net/manual/en/splfileobject.fstat.php Comment More infoAdvertise with us Next Article PHP | SplFileObject fgets() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-SplFileInfo Similar Reads PHP | SplFileObject fgets() Function The SplFileObject::fgets() function is an inbuilt function of the Standard PHP Library (SPL) in PHP which is used to get a line from the file. Syntax: string SplFileObject::fgets( void ) Parameters: This function does not accept any parameter. Return values: This function returns a string contain 1 min read PHP | SplFileObject fgets() Function The SplFileObject::fgets() function is an inbuilt function of the Standard PHP Library (SPL) in PHP which is used to get a line from the file. Syntax: string SplFileObject::fgets( void ) Parameters: This function does not accept any parameter. Return values: This function returns a string contain 1 min read PHP | SplFileObject ftruncate() Function The SplFileObject::ftruncate() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to truncates the file size in bytes. Syntax: bool SplFileObject::ftruncate( $length ) Parameters: This function accept single parameter $length which specified the length of truncate of 1 min read PHP | SplFileObject ftruncate() Function The SplFileObject::ftruncate() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to truncates the file size in bytes. Syntax: bool SplFileObject::ftruncate( $length ) Parameters: This function accept single parameter $length which specified the length of truncate of 1 min read PHP | SplFileObject ftell() Function The SplFileObject::ftell() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to return the position of the file pointer which specifies the current offset in the file. Syntax: int SplFileObject::ftell( void ) Parameters: This function does not accept any parameters. 1 min read PHP | SplFileObject ftell() Function The SplFileObject::ftell() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to return the position of the file pointer which specifies the current offset in the file. Syntax: int SplFileObject::ftell( void ) Parameters: This function does not accept any parameters. 1 min read Like