Challenge 2 — Solution Task: Explain, in your own words as a comment, what would happen if index.php used require 'config.php' but config.php didn't exist, versus what would happen if it used include 'config.php' instead. Write a short code example demonstrating the require case. PHP raises a fatal error ("Failed opening required // 'config.php'") and execution stops immediately at that line. // Nothing after it in the script runs at all - not even code // further down the same file that has nothing to do with // config.php. // // include 'config.php'; // -> PHP raises only a warning ("failed to open stream") and then // keeps running the rest of the script as normal. Any code that // depended on something config.php was supposed to define // (e.g. a $dbHost variable) would likely break later on with // its own separate "undefined variable" notice, but the script // itself does not stop outright. // Demonstrating the require case with a genuinely missing file: require 'this_file_does_not_exist.php'; // This line is never reached, because the require above already // triggered a fatal error and stopped the script. echo "This will never print."; ?> Output: PHP Fatal error: Uncaught Error: Failed opening required 'this_file_does_not_exist.php' Notes: - The core distinction is severity: require treats a missing file as a guaranteed showstopper (fatal, script halts); include treats it as a recoverable problem (warning only, script continues). - This is exactly why config.php - something a whole application usually can't function correctly without (database credentials, core settings) - should almost always be pulled in with require or require_once, not include. - The "echo" line after the require call is unreachable in this example precisely because the fatal error happens first, proving the script really does stop rather than merely warning and moving on.