PHP:仅在一组子域(生产子域和暂存子域)之间共享cookie

I have a site with its production url www.mysite.com & staging url staging.mysite.com, now I need to setup a set of sub-domains to be used by each environment like:

  1. From www0.mysite.com to www9.mysite.com for Production environment
  2. From staging0.mysite.com to staging9.mysite.com for Staging environment

So, how could I share the cookie between each set of sub-domains (per environment) without overlapping with the other set?

Note: if I used something like this in php.ini (or its equivelant in my code base):

session.cookie_domain = ".mysite.com"

then the cookie will be shared between all 2 sets of sub-domains (production & staging)