What is a common method in PHP to compare files in two directories and output the missing files?

To compare files in two directories and output the missing files, you can use the `scandir()` function to get the list of files in each directory, then compare the file lists to find the missing files. You can then output the missing files to the user.

$dir1 = '/path/to/first/directory';
$dir2 = '/path/to/second/directory';

$files1 = array_diff(scandir($dir1), array('..', '.'));
$files2 = array_diff(scandir($dir2), array('..', '.'));

$missing_files = array_diff($files1, $files2);

foreach ($missing_files as $file) {
    echo "Missing file: $file\n";
}