if(isset($_COOKIE['subscribed']))
{
// if cookie is there
$subscribe = false;
}
else
{
// if cookie is not there
$subscribe = true;
}
You could use a basic isset check first, somewhere in the top of your file before output.
Then in your head, in html do something like this:
<head>
<!-- standard head meta here -->
<?php if($subscribe): ?>
<script src="http://mysite.com/js/subscribe.js"></script>
<?php endif; ?>
</head>
You could also just run this inline, or use javascript to check cookies. This is just one example and it is handled like this in case anything else needed to be processed, unset, or anything else that would make sense of having cookies checked before output is sent.
shorter version you could use in place of the longer conditional above:
$subscribe = isset($_COOKIE['subscribe']) ? false : true;