When dealing with multiple uploaded images, what PHP function can be utilized to list files in a directory for display purposes?

When dealing with multiple uploaded images, one way to list the files in a directory for display purposes is by using the PHP `scandir()` function. This function scans a directory and returns an array of files and directories within it. By using `scandir()` in conjunction with a foreach loop, you can iterate through the array of files and display them on a webpage.

$directory = "uploads/"; // Directory where the uploaded images are stored
$files = scandir($directory);

foreach($files as $file){
    if($file != '.' && $file != '..'){
        echo '<img src="' . $directory . $file . '" alt="' . $file . '" />';
    }
}