Recall & Review
beginner
What happens to variables in PHP after a script finishes executing?
All variables and data stored in memory during the script execution are cleared. PHP resets memory for the next script run.
Click to reveal answer
beginner
Why does PHP reset memory after each script execution?
To ensure each script runs fresh without leftover data, preventing unexpected behavior and improving security.
Click to reveal answer
beginner
Can data persist between PHP script executions without external storage?
No. PHP does not keep data in memory between runs. To persist data, you must use files, databases, or sessions.
Click to reveal answer
intermediate
How does PHP handle memory during script execution?
PHP allocates memory for variables and data as the script runs, then frees all memory when the script ends.
Click to reveal answer
intermediate
What is the role of the PHP garbage collector in script execution?
The garbage collector frees memory used by variables no longer referenced during script execution, helping manage memory efficiently.
Click to reveal answer
What happens to PHP variables after the script finishes?
✗ Incorrect
PHP clears all variables from memory after the script ends to start fresh next time.
Which of these is needed to keep data between PHP script runs?
✗ Incorrect
Sessions, files, or databases are needed to store data beyond one script execution.
When does PHP free memory used by variables?
✗ Incorrect
PHP frees all memory used by variables when the script finishes running.
What is the PHP garbage collector's job?
✗ Incorrect
The garbage collector frees memory from variables no longer needed while the script runs.
Why is memory reset important in PHP script execution?
✗ Incorrect
Resetting memory prevents old data from affecting new script runs, avoiding bugs and security issues.
Explain what happens to memory and variables when a PHP script finishes running.
Think about how PHP treats data after the script ends.
You got /3 concepts.
Describe how you can keep data between PHP script executions despite memory reset.
Memory reset means data disappears, so what tools help keep data?
You got /4 concepts.