What is the issue with setting cookies on subdomains with underscores in PHP?

Setting cookies on subdomains with underscores in PHP can cause issues because browsers treat underscores as invalid characters in domain names. To solve this issue, you can use the `ini_set` function to set the `session.cookie_domain` configuration to the parent domain without underscores.

// Set the cookie domain without underscores
ini_set('session.cookie_domain', 'example.com');

// Set the cookie with the updated domain
setcookie('cookie_name', 'cookie_value', time() + 3600, '/', '.example.com');