These questions cover the 5 sections of the PHP overview and are organized into 3 topic clusters. No answers are provided — the goal is to test your understanding of PHP's execution model, its syntax and superglobals, and how it fits into the server-side ecosystem.
The questions mix conceptual understanding, technical reasoning, and cross-reference connections to other overviews.
<?php echo date('H:i:s'); ?>), explain how the server processes PHP blocks. What does the browser actually receive? Why does the overview call PHP "a templating language as much as a programming language"?/index.php through this flow. What role does Apache play? What role does the PHP interpreter play? How does this differ from a Node.js server handling the same request?<?php ... ?> blocks, replacing them with their output." What happens if a PHP file contains no <?php tags — just plain HTML? What does this tell you about PHP's relationship with HTML? Why is this different from how Node.js generates HTML output?req objects, sessions need middleware, and you need npm install)..php files." Compare this to deploying a Node.js application (which requires npm install, node app.js, and a process manager). Why is PHP's deployment model simpler? What trade-off does this simplicity involve?/cart.php → cart.php)." How does Apache's mod_php achieve this mapping automatically? How does the URL overview's discussion of URL structure relate? Why don't Node.js/Express applications have this automatic mapping?$_GET, $_POST, $_SESSION, $_COOKIE, and $_SERVER. These are "special arrays that are always available." Why are they called "superglobals"? How does $_GET['id'] from ?id=42 relate to the URL overview's discussion of query strings? Compare $_GET['id'] to Node.js's req.query.id.$username = htmlspecialchars($username, ENT_QUOTES, 'UTF-8'). Why is this function critical for security? What attack does it prevent? The Foundations overview discusses security concerns — how does output escaping relate to the broader principle of "never trust user input"?header('Content-Type: application/json'); echo json_encode(['status' => 'ok']); for returning JSON. Compare this to Node.js Express's res.json({ status: 'ok' }). What does PHP require that Express handles automatically? How does the REST overview's discussion of content types relate?session_start(); $_SESSION['user_id'] = 42; and setcookie('theme', 'dark', time() + 3600, '/'). How do sessions and cookies work together? The State Management overview explains that sessions use cookies to store a session ID. Trace the full flow: what does session_start() do, what cookie does it set, and how does $_SESSION persist data across the stateless HTTP protocol?