Intermediate
PHP
Q80 / 100
What is the difference between PHP's header() and setcookie()?
Correct! Well done.
Incorrect.
The correct answer is B) header() sends any HTTP header; setcookie() is a convenience wrapper for Set-Cookie headers. Both must be called before any output
B
Correct Answer
header() sends any HTTP header; setcookie() is a convenience wrapper for Set-Cookie headers. Both must be called before any output
Explanation
setcookie("name", "value", time()+3600) is equivalent to header("Set-Cookie: name=value; ..."). Both require no output before they are called.
Progress
80/100