⊗ppPmCkIR 330 of 447 menu

Instant Cookie Deletion in PHP

In order for the $_COOKIE array to change immediately when deleting a cookie, you can use the clever technique we already know:

<?php setcookie('test', '', time()); unset($_COOKIE['test']); var_dump($_COOKIE['test']); ?>

Let's add a condition so as not to delete an already deleted cookie every time:

<?php if (isset($_COOKIE['test'])) { setcookie('test', '', time()); unset($_COOKIE['test']); } var_dump($_COOKIE['test']); // deleted ?>

Delete some cookie using the clever technique. Make sure it gets deleted immediately.

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