print(fileinode(data.txt));
?>
integer filemtime(string filename)
The filemtime function returns the last time a file was modified in standard timestamp
format, the number of seconds since January 1, 1970. FALSE is returned if there is an
error. A file is considered modified when it is created or its contents change. Operation of
this function is identical under any operating system. There are two other functions
related to timestamps on files: fileatime and filectime.
<?
$LastMod = filemtime("data.txt");
print("Last modification was ");
print(date("l F d, Y", $LastMod));
?>
integer fileowner(string filename)
The fileowner function returns the user identifier of the owner, or false if there is an
error. This function always returns FALSE under Windows. If you need to change the
owner of a file, use the chown function. Similar functions for getting information about a
file are filegroup, fileinode and fileperms.
<?
print(fileowner("data.txt"));
?>
integer fileperms(string filename)
The fileperms function returns the permission number for the given file, or false when
there is an error. If you are using UNIX, you may wish to refer to the man page for the
stat system function. You may be surprised to find that printing this number in octal, as is
customary, produces six digits. The first three give you information about the file that
don't actually refer to read/write/execute permissions. You may wish to filter that
information out, as I have in the example, by performing a logical AND operation. If you
need to change the mode of a file, use the chmod function.
<?
printf("%o", (fileperms("data.txt") & 0777));
?>