What is the potential impact on resource usage when including a file with constants and class object initialization in every PHP page?

Including a file with constants and class object initialization in every PHP page can lead to increased resource usage, as the file will be loaded and executed on every page request. To solve this issue, we can use PHP's autoloading feature to only load the necessary classes when they are actually needed, reducing the overall resource usage.

// autoloader.php
spl_autoload_register(function ($class) {
    include 'path/to/classes/' . $class . '.php';
});

// index.php
require_once 'autoloader.php';

// rest of your code