stat() function

Run C Language based stat() function on named file and print out results.
The stat() function, in this case, is coded for and run only on Unix platform
although with some minor changes will also run on Windows platform.

Begin PHP output

Device: 23
INode: -1125431604
Mode: 100604
Links: 1
UID: 5218039
GID: 450
Device Type: 0
Links: 258
Last Accessed: 00:08:47 May 17, 2018
Last Modified: 00:08:47 May 17, 2018
Last Changed: 00:08:47 May 17, 2018
Block Size: 512
Blocks: 68

End PHP output

/** print stat info

$statInfo = stat("data.txt");

printf("Device: $statInfo[0] <br />\n");
printf("INode: $statInfo[1] <br />\n");
printf("Mode: %o <br>\n",$statInfo[2]);
printf("Links: $statInfo[3] <br />\n");
printf("UID: $statInfo[4] <br />\n");
printf("GID: $statInfo[5] <br />\n");
printf("Device Type: $statInfo[6] <br />\n");
printf("Links: $statInfo[7] <br />\n");
printf("Last Accessed: %s <br />\n",date("H:i:s F d, Y", $statInfo[8]));
printf("Last Modified: %s <br />\n",date("H:i:s F d, Y", $statInfo[9]));
printf("Last Changed: %s <br />\n",date("H:i:s F d, Y", $statInfo[10]));
printf("Block Size: $statInfo[11] <br />\n");
printf("Blocks: $statInfo[12] <br />\n");


Back to Bill's PHP