How to set and get and delete cookie in PHP?

Posted by Editorial Staff | Updated on

To set a cookie in PHP, use the setcookie() function is used. The setcookie() function needs to be called prior to any output generated by the script otherwise the cookie will not be set. Syntax : setcookie(name, value, expire, path, domain, security);


Example #1 setcookie() send example

Example #2 setcookie() delete example

Example #3 setcookie() and arrays


Further Reading:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers