Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

<?
$LastAccess = fileatime("data.txt");
print("Last access was ");
print(date("l F d, Y", $LastAccess));
?>


integer filectime(string filename)


When running on UNIX, the filectime function returns the last time a file was changed
in standard timestamp format, the number of seconds since January 1, 1970. A file is
considered changed if it is created or written to or its permissions have been changed.
When running on Windows, filectime returns the time the file was created. If an error
occurs, FALSE is returned.


Two other functions for getting timestamps associated with files are fileatime and
filemtime.


<?
$LastChange = filectime("data.txt");
print("Last change was ");
print(date("l F d, Y", $LastChange));
?>


integer filegroup(string filename)


The filegroup function returns the group identifier for the given file, or FALSE when
there is an error. This function always returns FALSE under Windows. Other functions
that return information about a file are file-inode, fileowner, and fileperms. To
change a file's group, use chgrp.


<?
print(filegroup("data.txt"));
?>


integer fileinode(string filename)


The fileinode function returns the inode of the given file, or FALSE on error. This
function always returns FALSE under Windows. Similar functions are filegroup,
fileowner, and fileperms.


<?

Free download pdf