Bird
0
0

What happens to variables in a PHP script after the script finishes running?

easy📝 Conceptual Q11 of 15
PHP - Request Lifecycle
What happens to variables in a PHP script after the script finishes running?
AVariables are saved permanently in the script file
BVariables keep their values until the server restarts
CAll variables and memory are reset and cleared
DVariables are shared with other scripts automatically
Step-by-Step Solution
Solution:
  1. Step 1: Understand PHP script execution

    PHP runs scripts from top to bottom each time the page loads.
  2. Step 2: Memory and variable reset after execution

    After the script finishes, all variables and memory used are cleared to keep the environment clean.
  3. Final Answer:

    All variables and memory are reset and cleared -> Option C
  4. Quick Check:

    PHP resets variables after script ends = C [OK]
Quick Trick: Remember PHP resets memory after each script run [OK]
Common Mistakes:
  • Thinking variables keep values between page loads
  • Assuming variables save to the script file
  • Believing variables are shared across scripts automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes