You can use the filectime()
function in PHP to get the creation time of a file. This function takes a file path as a parameter and returns the Unix timestamp of when the file was last changed (including the creation time).
Here's an example:
main.php207 chars8 lines
This code checks if the file exists and if it does, it retrieves the creation time using filectime()
and formats it using the date()
function.
Note that the creation time of a file is not always available on every operating system or file system, so filectime()
may return the last modification time instead.
gistlibby LogSnag