Recall & Review
beginner
What is a manual include in PHP?
A manual include is when you explicitly write code to load a PHP file using statements like
include or require. You tell PHP exactly which file to load and when.Click to reveal answer
beginner
What does autoloading do in PHP?
Autoloading automatically loads PHP classes when they are needed, without you writing <code>include</code> or <code>require</code> for each file. PHP calls a special function to find and load the class file on demand.Click to reveal answer
intermediate
Name one advantage of autoloading over manual includes.
Autoloading reduces the need to write many
include or require statements, making code cleaner and easier to maintain. It loads files only when needed, improving performance.Click to reveal answer
intermediate
What PHP function is commonly used to register an autoloader?
The function
spl_autoload_register() is used to register one or more autoload functions that PHP calls automatically to load classes.Click to reveal answer
beginner
What happens if a manual include file is missing?
If you use
require and the file is missing, PHP stops the script with a fatal error. If you use include, PHP shows a warning but continues running the script.Click to reveal answer
Which PHP statement is used for manual file inclusion?
✗ Incorrect
The
include statement is used to manually include PHP files.What does
spl_autoload_register() do?✗ Incorrect
It registers a function that PHP calls to load classes automatically when needed.
Which is a benefit of autoloading over manual includes?
✗ Incorrect
Autoloading loads files only when the class is actually used, improving efficiency.
What happens if a required file is missing in manual include?
✗ Incorrect
Using
require causes a fatal error if the file is missing, stopping the script.Which PHP feature helps avoid writing many include statements?
✗ Incorrect
Autoloading automatically loads class files, reducing the need for manual includes.
Explain the difference between manual includes and autoloading in PHP.
Think about how files are loaded and when.
You got /4 concepts.
Describe one advantage and one disadvantage of manual includes compared to autoloading.
Consider ease of use and maintenance.
You got /3 concepts.