I run into a lot of trouble migrating from my test server to production server because of case sensitive class name mismatches that aren't caught in test. The autoloader fails in production server (Linux) but does not catch errors on the test server (Windows). Is there a way to make my autoloader throw an error if the class name case does not match the file name case?
Here is the code:
function autoload_class_multiple_directory($class_name)
{
# List all the class directories in the array.
$array_paths = array('classes/HTMLelements/','classes/','secret/classes/');
# Count the total item in the array.
$total_paths = count($array_paths);
# Set the class file name.
$file_name = $class_name.'.php';
# Loop the array.
for ($i = 0; $i < $total_paths; $i++)
{
if(file_exists($array_paths[$i].$file_name))
{
include_once $array_paths[$i].$file_name;
}
}
}