The order of the extensions influence the velocity of the reply. For example:
spl_autoload_extensions(".php, .inc");
is more fast than:
spl_autoload_extensions(".inc, .php");
Check out this example:
Some class files:
ClassA.php
<?php class ClassA { var $val = 'Hello from class "ClassA"'; } ?>
ClassB.php
<?php class ClassB { var $val = 'Hello from class "ClassB"'; } ?>
ClassC.php
<?php class ClassC { var $val = 'Hello from class "ClassC"'; } ?>
ClassD.php
<?php class ClassD { var $val = 'Hello from class "ClassD"'; } ?>
ClassE.php
<?php class ClassE { var $val = 'Hello from class "ClassE"'; } ?>
1. Simple:
<?php
for($n=65; $n<70; $n++) {
$className = 'Class'.chr($n);
spl_autoload($className);
$ins = new $className;
echo $ins->val.'<br>';
}
?>
2. Change priority:
<?php
spl_autoload_extensions('.php,.inc');
for($n=65; $n<70; $n++) {
$className = 'Class'.chr($n);
spl_autoload($className);
$ins = new $className;
echo $ins->val.'<br>';
}
?>