Question 46
Which function sets a cookie to be sent along with the HTTP response headers in PHP?
Option E is correct. setcookie(name, value, expire, path, domain, secure, httponly) defines a cookie to be sent along with the rest of the HTTP headers.
Which function sets a cookie to be sent along with the HTTP response headers in PHP?
Option E is correct. setcookie(name, value, expire, path, domain, secure, httponly) defines a cookie to be sent along with the rest of the HTTP headers.
What is the superglobal array $_SERVER used for in PHP?
Option D is correct. $_SERVER is an array containing information created by the web server, such as HTTP_USER_AGENT, SERVER_ADDR, REQUEST_METHOD, and SCRIPT_NAME.
How do comments start and end in multi-line PHP script blocks?
Option C is correct. PHP supports multi-line comments using /* comment */, single line comments using // or #, identical to C/C++ style.
What will isset($var) return in PHP if $var is declared and its value is set to null?
Option A is correct. isset() determines if a variable is declared and is different than NULL. If $var is set to null, isset($var) returns false.
Which HTTP request method is idempotent and safe according to standard REST web protocols?
Option A is correct. GET is safe and idempotent-calling it multiple times produces identical results without altering server-side state. POST is non-idempotent.