setcookie() is a function that allows you to set a cookie variable, but you have to be careful about messing up your original session variable. If PHP handles setting and retrieving your session ID in a cookie, you're probably best off configuring PHP to create a cookie that works across sub-domains.
If you have written your own session handling functions (and, in my opinion, it sounds like a good idea for your multi-domain site to do so, especially if each domain is on a different machine. If you're using the same database server to store all your session data, you can use a cookie to store the session ID for all sub-domains, and each server uses the same session handling functions and database server to access that user's session.
If I'm not making sense, let me know.
Take care,
Nik
http://www.bigaction.org/