PHP SplFileObject fstat () function

Syntax:
array SplFileObject::fstat (void)
Parameters:this function takes no parameters.Return Values:This function returns an array that contains detailed information about the file.The following programs illustrate the SplFileObject function::fstat() in PHP:Program 1:  
// Create a SplFile object $gfg = new SplFileObject ( "gfg.txt" , "r" ); $stat = $gfg -> fstat ();  
// Print the 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 information about the current file.  
// Create Spl object $gfg = new SplFileObject ( __ FILE__ , "r" ); $stat = $gfg -> fstat ();  
// Print the 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)
Link: http://php.net/manual/en/splfileobject. fstat.php



Get Solution for free from DataCamp guru