Thursday, September 4, 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
32261 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6626 POSTS0 COMMENTS
Nicole Veronica
11795 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11855 POSTS0 COMMENTS
Shaida Kate Naidoo
6747 POSTS0 COMMENTS
Ted Musemwa
7023 POSTS0 COMMENTS
Thapelo Manthata
6695 POSTS0 COMMENTS
Umr Jansen
6714 POSTS0 COMMENTS