How does the setcookie() function in PHP handle the Domain parameter?

When setting a cookie using the setcookie() function in PHP, the Domain parameter specifies the domain for which the cookie is valid. If not set properly, the cookie may not be accessible across subdomains or may not be set at all. To ensure the cookie is accessible across subdomains, set the Domain parameter to the root domain preceded by a dot (e.g., ".example.com").

setcookie("cookie_name", "cookie_value", time() + 3600, "/", ".example.com");