⊗ppPmCkRm 329 of 447 menu

Deleting Cookies in PHP

PHP does not have a built-in mechanism for deleting cookies. Therefore, cookies are deleted using a clever method - by setting the cookie's 'death' time to the current moment:

<?php setcookie('test', '', time()); ?>

Deleting a cookie will lead to a change in $_COOKIE only after the page is reloaded:

<?php setcookie('test', '', time()); var_dump($_COOKIE['test']); // will output the cookie value the first time ?>

Delete some cookie. Refresh the page and make sure it has been deleted.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline