Friday, October 24, 2025
HomeLanguagesPHP realpath_cache_size() Function

PHP realpath_cache_size() Function

The realpath_cache_size() function is an inbuilt function in PHP that allows you to get or set the size of the realpath cache in bytes.

Syntax:

realpath_cache_size(): int

Parameter: This function does not accept any parameters.

Return Value: This function returns the current size of the real path cache in bytes.

Example 1: The following program demonstrates the  realpath_cache_size() function.

PHP




<?php
$cache_size = realpath_cache_size();
echo "The current size of the realpath cache is " . 
      $cache_size . " bytes.";
?>


Output:

The current size of the realpath cache is 538 bytes.  

Example 2: The following program demonstrates the realpath_cache_size() function.

PHP




<?php
$threshold = 10485760;
$cache_size = realpath_cache_size();
  
if ($cache_size > $threshold) {
    echo "The current size of the realpath cache
        is greater than the threshold.";
} else {
    echo "The current size of the realpath cache is less 
        than or equal to the threshold.";
}
?>


Output:

The current size of the realpath cache 
is less than or equal to the threshold.

Reference: https://www.php.net/manual/en/function.realpath-cache-size.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