What are the potential issues that can arise when trying to load plugins without an Autoloader in PHP?

When trying to load plugins without an Autoloader in PHP, one potential issue is that you may need to manually include each plugin file, which can be cumbersome and error-prone. To solve this issue, you can create a simple function that dynamically loads the required plugin files based on a predefined naming convention.

function load_plugin($plugin_name) {
    $plugin_file = __DIR__ . '/plugins/' . $plugin_name . '.php';
    
    if (file_exists($plugin_file)) {
        require_once $plugin_file;
    } else {
        echo 'Plugin file not found: ' . $plugin_name;
    }
}

// Example of loading a plugin named 'example'
load_plugin('example');