How can the PHP code be optimized to improve performance when searching for MP3 files in a large directory?

Searching for MP3 files in a large directory can be slow if not optimized properly. One way to improve performance is to use the PHP `glob()` function with a specific pattern to only search for MP3 files directly. This will reduce the number of files that need to be processed, resulting in faster search times.

$files = glob('/path/to/directory/*.mp3');
foreach ($files as $file) {
    // Process each MP3 file
}