PHP Program to Check if cookies are enabled

To check if cookies are enabled in PHP, we can use the `setcookie()` function to set a cookie with a test value and then check if the cookie is present in subsequent requests.

Here's an example program to demonstrate this :
Program :
<?php
// Set a test cookie with a value of "test"
setcookie("test_cookie", "test", time() + 3600);

// Check if the test cookie is set
if (isset($_COOKIE["test_cookie"])) {
    echo "Cookies are enabled.";
} else {
    echo "Cookies are disabled.";
}
?>
In this program, we first use the `setcookie()` function to set a cookie named "test_cookie" with a value of "test" and an expiration time of 1 hour from the current time (specified by `time() + 3600`).

Then, we check if the cookie is set using the `isset()` function and the `$_COOKIE` superglobal array. If the cookie is set, we output "Cookies are enabled." Otherwise, we output "Cookies are disabled."