Introduction
In this article I describe the PHP FileSystem functions fileinode, filemtime, fileowner and fileperms. To learn some other FileSystem functions, go to:
- FileSystem Function in PHP: PART 1
- FileSystem Function in PHP: PART 2
- FileSystem Function in PHP: PART 3
- FileSystem Function in PHP: PART 4
- FileSystem Function in PHP: PART 5
- FileSystem Function in PHP: PART 6
PHP fileinode() Function
The PHP fileinode function is used to get the inode number of the specified file, in other words it returns the inode number of the file or false on failure.
Syntax
Parameter in fileinode function
The parameter of the function is:
Parameter |
Description |
filename |
It specifies the file to check. |
Example
An example of the function is:
<?php
echo fileinode("test.txt");
?>
Output
PHP filemtime() Function
The PHP filemtime function is used to get the file modification time. It returns the time that the file was last modified, or false on failure.
Syntax
Parameter in filemtime function
The parameter of the function is:
Parameter |
Description |
filename |
It specifies the file to check. |
Example
An example of the function is:
<?php
$time = time();
echo "current date and times is ".date("m/d/y H:i:s ", $time);
echo "<br>current File Modification Time is ".date("m/d/y H:i:s ", filemtime("test.txt"));
?>
Output
PHP fileowner() Function
The PHP fileowner function is used to get the owner id, in other words it returns the user id of the owner of the file or false on failure.
Syntax
Parameter in fileowner function
The parameter of the function is:
Parameter |
Description |
filename |
It specifies the file to check. |
Example
An example of the function is:
<?php
echo fileowner("test.txt");
?>
PHP fileperms() Function
The PHP fileperms function gets the file permission and retunes the file's permission as a numeric mode.
Syntax
Parameter in fileperms function
The parameter of the function is:
Parameter |
Description |
filename |
It specifies the file to check. |
Example
An example of the function is:
<?php
$time = time();
echo "current date and times is ".date("m/d/y H:i:s ", $time);
echo "<br>current File Modification Time is ".date("m/d/y H:i:s ", filemtime("test.txt"));
?>
Output