What are the advantages and disadvantages of writing an independent loader in PHP to address issues related to file name capitalization errors?

When working with file systems that are case-insensitive, such as on Windows, issues can arise with file name capitalization errors. One way to address this is by writing an independent loader in PHP that can handle file name capitalization discrepancies by checking for the correct file name casing before including or requiring the file.

function includeFile($filename) {
    $files = glob($filename);
    if (count($files) > 0) {
        include_once($files[0]);
    } else {
        // Handle error or log message
    }
}

includeFile('path/to/SomeFile.php');