Complete the code to manually include the file 'User.php'.
<?php [1] 'User.php'; $user = new User(); ?>
The include statement is used to manually include a PHP file.
Complete the code to register an autoloader function named 'myAutoloader'.
<?php spl_autoload_[1]('myAutoloader'); ?>
The function spl_register does not exist, but spl_autoload_register does. The correct function is spl_autoload_register.
Fix the error in the autoloader function to correctly load class files from the 'classes/' directory.
<?php
function myAutoloader($className) {
include_once 'classes/' . [1] . '.php';
}
spl_autoload_register('myAutoloader');
?>The parameter name is $className, so it must be used exactly as is inside the function.
Fill both blanks to create an autoloader that loads classes from the 'lib/' directory and uses the class name with '.class.php' extension.
<?php function [1]($class) { include_once 'lib/' . $class . [2]; } spl_autoload_register('[1]');
The function name is 'myAutoloader' and the file extension is '.class.php' to match the class files.
Fill all three blanks to create an autoloader that loads classes from the 'src/' directory, converts class names to lowercase, and uses '.inc.php' extension.
<?php function [1]($className) { $file = 'src/' . strtolower([2]) . [3]; if (file_exists($file)) { include_once $file; } } spl_autoload_register('[1]');
The function name is 'autoLoadClass', the variable is '$className', and the file extension is '.inc.php'.