How can PHP be used to list the files in a directory similar to Apache's Directory Listening feature?

To list the files in a directory using PHP similar to Apache's Directory Listening feature, you can use the `scandir()` function to scan the directory and retrieve an array of files and directories. You can then loop through this array and display the file names as links for easy navigation.

<?php
$dir = "path/to/directory";

// Scan the directory and retrieve an array of files and directories
$files = scandir($dir);

// Loop through the array and display the file names as links
foreach($files as $file) {
    if ($file != '.' && $file != '..') {
        echo "<a href='$dir/$file'>$file</a><br>";
    }
}
?>