What are the limitations of setting cookies with PHP in terms of host domains?

When setting cookies with PHP, the domain parameter restricts the cookie to a specific domain and its subdomains. This means that cookies set for one domain cannot be accessed by another domain. To set a cookie that can be accessed across multiple subdomains or domains, you can use the wildcard character '.' at the beginning of the domain name.

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