Recall & Review
beginner
What is the $_REQUEST superglobal in PHP?
The $_REQUEST superglobal is an associative array in PHP that contains data from the GET, POST, and COOKIE input methods combined.
Click to reveal answer
beginner
Which input types does $_REQUEST include by default?
By default, $_REQUEST includes data from $_GET, $_POST, and $_COOKIE arrays.
Click to reveal answer
intermediate
How does PHP decide the order of variables in $_REQUEST?
PHP uses the 'request_order' or 'variables_order' configuration in php.ini to decide the order of GET, POST, and COOKIE variables in $_REQUEST.
Click to reveal answer
intermediate
What happens if a variable name exists in both $_GET and $_POST when accessed via $_REQUEST?
The value that appears first in the 'request_order' or 'variables_order' configuration will be used in $_REQUEST, potentially overriding the other.
Click to reveal answer
advanced
Why might relying on $_REQUEST be risky in PHP?
Because $_REQUEST mixes GET, POST, and COOKIE data, it can lead to security issues or unexpected behavior if variable names overlap or if the source of data is important.
Click to reveal answer
Which of the following is NOT included in the default $_REQUEST array?
✗ Incorrect
$_SESSION data is not included in $_REQUEST; only $_GET, $_POST, and $_COOKIE are included by default.
If a variable 'user' exists in both $_GET and $_POST, which value does $_REQUEST['user'] hold?
✗ Incorrect
The order of variables in $_REQUEST depends on the 'request_order' or 'variables_order' configuration in php.ini.
What PHP configuration directive controls the order of variables in $_REQUEST?
✗ Incorrect
'request_order' controls the order of GET, POST, and COOKIE variables in $_REQUEST.
Why should you be cautious when using $_REQUEST in your PHP code?
✗ Incorrect
$_REQUEST mixes GET, POST, and COOKIE data, which can cause security issues if not handled carefully.
Which superglobal should you use if you want to access only POST data?
✗ Incorrect
Use $_POST to access only POST data, avoiding confusion from other sources.
Explain how PHP's $_REQUEST array is constructed and what configuration affects its behavior.
Think about which input sources are merged and how PHP decides which value to keep.
You got /3 concepts.
Describe potential risks of using $_REQUEST in PHP applications and how to avoid them.
Consider what happens when data from different sources overlap.
You got /4 concepts.