$filename = '/path/to/file.txt'; if (is_readable($filename)) { $readable_path = readablePath($filename); echo "The file is readable at: $readable_path"; } else { echo "The file is not readable."; }
$dir = '/path/to/directory'; if (is_dir($dir)) { $files = scandir($dir); foreach ($files as $file) { $file_path = $dir . '/' . $file; if (is_readable($file_path)) { $readable_path = readablePath($file_path); echo "The file is readable at: $readable_path"; } else { echo "The file is not readable."; } } }In this example, we loop through a directory and check if each file is readable. If it is readable, we use the `readablePath()` function to return its path. Package library: PHP Filesystem Extension