Monday, December 8, 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
32429 POSTS0 COMMENTS
Milvus
103 POSTS0 COMMENTS
Nango Kala
6803 POSTS0 COMMENTS
Nicole Veronica
11947 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12015 POSTS0 COMMENTS
Shaida Kate Naidoo
6936 POSTS0 COMMENTS
Ted Musemwa
7190 POSTS0 COMMENTS
Thapelo Manthata
6884 POSTS0 COMMENTS
Umr Jansen
6872 POSTS0 COMMENTS