Which PHP function is used to set a cookie?
- setCookie()
- createCookie()
- sendCookie()
- cookie()
The correct function is setCookie(). It is used in PHP to set cookies on the client's browser. Cookies are often used for tracking user preferences or maintaining session data.
Loading...
Related Quiz
- You have a PHP script and you are getting an error when trying to send an email. How would you troubleshoot this issue using mail functions?
- In the context of web security, what is the primary purpose of Content Security Policy (CSP)?
- How can you modify the lifetime of a cookie in PHP?
- The json_encode() function is used to encode a PHP array into a JSON object.
- You need to access server-specific information in your PHP script. How would you do this using the $_SERVER superglobal?