You need to delete a cookie in your PHP script. How would you do this?
- setcookie() with expiry 0
- unset($_COOKIE['cookie_name'])
- delete_cookie()
- remove_cookie()
To delete a cookie in PHP, you can use the setcookie() function with an expiration time in the past or set it to zero. This will invalidate the cookie and remove it from the user's browser. Alternatively, you can use the unset() function to remove a specific cookie value from the $_COOKIE superglobal array. More details: http://php.net/manual/en/function.setcookie.php
Loading...
Related Quiz
- What does the unset() function mean?
- You are writing a PHP script and you need to include a file. How would you do this?
- How can you create a file in PHP?
- What is the return type of the time() function in PHP?
- In PHP, you can define a static method using the static keyword like public static function FunctionName() { ______ }.