Thursday, October 23, 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
32361 POSTS0 COMMENTS
Milvus
88 POSTS0 COMMENTS
Nango Kala
6728 POSTS0 COMMENTS
Nicole Veronica
11892 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11954 POSTS0 COMMENTS
Shaida Kate Naidoo
6852 POSTS0 COMMENTS
Ted Musemwa
7113 POSTS0 COMMENTS
Thapelo Manthata
6805 POSTS0 COMMENTS
Umr Jansen
6801 POSTS0 COMMENTS