PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php // Set a cookie with the name 'user' and value 'John Doe' setcookie('user', 'John Doe', time() + 3600); // Expires in 1 hour (3600 seconds) echo "Cookie 'user' is set.\n"; // Check if the cookie is set if(isset($_COOKIE['user'])) { echo "\nValue of 'user' cookie: " . $_COOKIE['user']; } else { echo "\nCookie 'user' is not set."; } // Delete the cookie by setting its expiration time to a past time setcookie('user', '', time() - 3600); // Expire the cookie echo "\nCookie 'user' is deleted."; ?>
Show:  
Copy Clear