PHP realpath_cache_get() Function Last Updated : 19 May, 2023 Comments Improve Suggest changes Like Article Like Report The realpath_cache_get() function is an inbuilt function in PHP that retrieves the current contents of the realpath cache. The realpath cache is used by PHP to store the results of mapping file paths to their real or canonical paths on the filesystem. Syntax: realpath_cache_get(): arrayParameters: This function does not accept any parameter. Return Values: The realpath_cache_get() function in PHP returns an array containing information about the current contents of the realpath cache. Each entry in the array corresponds to a cached realpath and includes the following information: filename: The path that was used to generate the cached realpath.realpath: The real or canonical path on the filesystem that corresponds to the cached path.expires: The timestamp at which the cached realpath will expire and be removed from the cache.Example 1: The following program demonstrates the realpath_cache_get() function. PHP <?php $cache = realpath_cache_get(); print_r($cache); ?> Output: Array ( [/home/dachman/Desktop] => Array ( [key] => 9.8987350635605E+18 [is_dir] => 1 [realpath] => /home/dachman/Desktop [expires] => 1680790990 ) [/home/dachman/Desktop/Articles/GFG/Method/index.php] => Array ( [key] => 1.1713322467E+19 [is_dir] => [realpath] => /home/dachman/Desktop/Articles/GFG/Method/index.php [expires] => 1680790990 ) [/home] => Array ( [key] => 4353355791257440477 [is_dir] => 1 [realpath] => /home [expires] => 1680790990 ) [/home/dachman/Desktop/Articles/GFG] => Array ( [key] => 1.7522950215249E+19 [is_dir] => 1 [realpath] => /home/dachman/Desktop/Articles/GFG [expires] => 1680790990 ) [/home/dachman/Desktop/Articles] => Array ( [key] => 1.4472601227808E+19 [is_dir] => 1 [realpath] => /home/dachman/Desktop/Articles [expires] => 1680790990 ) [/home/dachman/Desktop/Articles/GFG/Method] => Array ( [key] => 1554988915540397794 [is_dir] => 1 [realpath] => /home/dachman/Desktop/Articles/GFG/Method [expires] => 1680790990 ) [/home/dachman] => Array ( [key] => 1.4619779138232E+19 [is_dir] => 1 [realpath] => /home/dachman [expires] => 1680790990 ) ) Example 2: The following program demonstrates the realpath_cache_get() function. PHP <?php $cache = realpath_cache_get(); foreach ($cache as $path => $info) { echo "Path: $path\n"; echo "Realpath: {$info["realpath"]}\n"; echo "Expires: " . date("Y-m-d H:i:s", $info["expires"]) . "\n\n"; } ?> Output: Path: /home/dachman/Desktop Realpath: /home/dachman/Desktop Expires: 2023-04-06 14:27:00 Path: /home/dachman/Desktop/Articles/GFG/Method/index.php Realpath: /home/dachman/Desktop/Articles/GFG/Method/index.php Expires: 2023-04-06 14:27:00 Path: /home Realpath: /home Expires: 2023-04-06 14:27:00 Path: /home/dachman/Desktop/Articles/GFG Realpath: /home/dachman/Desktop/Articles/GFG Expires: 2023-04-06 14:27:00 Path: /home/dachman/Desktop/Articles Realpath: /home/dachman/Desktop/Articles Expires: 2023-04-06 14:27:00 Path: /home/dachman/Desktop/Articles/GFG/Method Realpath: /home/dachman/Desktop/Articles/GFG/Method Expires: 2023-04-06 14:27:00 Path: /home/dachman Realpath: /home/dachman Expires: 2023-04-06 14:27:00 Note: Output is system-specific & will be different according to the system. Reference: https://www.php.net/manual/en/function.realpath-cache-get.php Comment More infoAdvertise with us Next Article PHP realpath_cache_get() Function neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-Filesystem Similar Reads 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 ca 1 min read PHP | realpath( ) Function The realpath() function in PHP is an inbuilt function which is used to return the canonicalized absolute pathname. The realpath() function removes all symbolic links such as '/./' '/../' and extra '/' and returns the absolute pathname. The path is sent as a parameter to the realpath() function and i 2 min read PHP | stream_get_meta_data() Function The stream_get_meta_data() function is an inbuilt function in PHP which is used to get the header or meta data from the streams/file pointers.Syntax: array stream_get_meta_data( $stream ) Parameters: The function accepts single parameter $stream, which specifies the meta data to be retrieve and whic 2 min read PHP sys_get_temp_dir() Function The sys_get_temp_dir() is an inbuilt function where the directory path for temporary files will be returned. Syntax: sys_get_temp_dir()Parameter: This function doesn't accept any parameter. Return Value: This function returns the path for the temporary directory. Example 1: This code demonstrates th 1 min read PHP | get_defined_vars() Function The get_defined_vars() function is an inbuilt function in PHP which is used to returns an array of all defined variables. This function returns a multidimensional array which contains all the list of variables, environment etc. Syntax: array get_defined_vars( void ) Parameters: This function does no 1 min read PHP get_resources() Function The get_resources() function is an inbuilt function in PHP that returns active resources in an array form, & optionally, the resource type will be filtered. Syntax: array get_resources(?string $type = null)Parameters: This function accepts one parameter that is described below: type: This parame 1 min read PHP | CachingIterator next() Function The CachingIterator::next() function is an inbuilt function in PHP which is used to move the iterator to the forward. Syntax: void CachingIterator::next( void ) Parameters: This function does not accept any parameters. Return Value: This function does not return any value. Below programs illustrate 1 min read PHP | CachingIterator getCache() Function The CachingIterator::getCache() function is an inbuilt function in PHP which is used to retrieve the contents of the cache. Syntax: array CachingIterator::getCache( void ) Parameters: This function does not accept any parameters. Return Value: This function returns an array containing the cache item 2 min read PHP | CachingIterator getFlags() Function The CachingIterator::getFlags() function is an inbuilt function in PHP which is used to get the bitmask of the flags used for this CachingIterator instance. Syntax: int CachingIterator::getFlags( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the 1 min read PHP | CachingIterator setFlags() Function The CachingIterator::setFlags() function is an inbuilt function in PHP which is used to set the flags for the CachingIterator object. Syntax: void CachingIterator::setFlags( int $flags ) Parameters: This function accepts a single parameter $flags which holds the value of bitmask of the flags to set. 1 min read Like