Bird
0
0

After a PHP script finishes executing for a web request, what happens to the variables defined during that request?

easy📝 Conceptual Q1 of 15
PHP - Request Lifecycle
After a PHP script finishes executing for a web request, what happens to the variables defined during that request?
AThey are sent to the client browser for storage
BThey are saved automatically to a file for the next request
CThey remain in memory for reuse by the next request
DThey are destroyed and do not persist to the next request
Step-by-Step Solution
Solution:
  1. Step 1: Understand PHP's request lifecycle

    PHP runs each script in isolation per request.
  2. Step 2: Variable scope

    Variables exist only during the script execution and are cleared after the request ends.
  3. Final Answer:

    They are destroyed and do not persist to the next request -> Option D
  4. Quick Check:

    PHP variables reset after each request [OK]
Quick Trick: PHP variables reset after each request [OK]
Common Mistakes:
  • Assuming variables persist automatically between requests
  • Confusing PHP variables with session or cookie data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes