What function can be used to search a directory and create an index page in PHP?
To search a directory and create an index page in PHP, you can use the `scandir()` function to get a list of files in the directory, filter out any unwanted files (like `.` and `..`), and then display the file names in an HTML list on the index page.
<?php
$dir = "path/to/directory";
$files = array_diff(scandir($dir), array('..', '.'));
echo "<ul>";
foreach($files as $file) {
echo "<li><a href='$dir/$file'>$file</a></li>";
}
echo "</ul>";
?>