Thursday, September 25, 2025
HomeLanguagesPHP fileinode() Function

PHP fileinode() Function

The fileinode() function is an inbuilt function in PHP that returns the inode of the file.

Syntax:

fileinode(string $filename): int|false

Parameter: This function has only one parameter:

  • filename: This parameter specifies the path for the particular file.

Return Value: This function returns the inode number of the file otherwise returns “false”.

Error: Depending upon the failure, an E_WARNING will be emitted.

Example 1: The following code demonstrates the fileinode() function.

PHP




<?php
  
$filename = "index.php";
  
if (getmyinode() == fileinode($filename)) {
    echo "You are checking the current file.";
}
  
?>


Output:

You are checking the current file.

Example 2: The following code is another demonstration of the fileinode() function.

PHP




<?php
  
$filename = "text.txt";
  
if (getmyinode() == fileinode($filename)) {
    echo "You are checking the current file.";
} else {
    echo "You are not checking the current files";
}
  
?>


Output:

You are not checking the current files 

Reference: https://www.php.net/manual/en/function.fileinode.php

RELATED ARTICLES

Most Popular

Dominic
32319 POSTS0 COMMENTS
Milvus
84 POSTS0 COMMENTS
Nango Kala
6681 POSTS0 COMMENTS
Nicole Veronica
11854 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11910 POSTS0 COMMENTS
Shaida Kate Naidoo
6794 POSTS0 COMMENTS
Ted Musemwa
7070 POSTS0 COMMENTS
Thapelo Manthata
6753 POSTS0 COMMENTS
Umr Jansen
6761 POSTS0 COMMENTS