title: How to access cookie set on root domain when the current subdomain has a cookie with the same name?
body: <p>I have two cookies with the same name set - one on my root domain, and one on a subdomain.  By default, if you are on a matching subdomain, PHP will read the subdomain cookie and ignore the root cookie.  How would I read the root domain cookie when there is a matching subdomain cookie?</p>
  
  <p>For example, lets say I have these two cookies:</p>
  
  <pre><code>Name | Value | Domain
  uid  | 12345 | .example.com
  uid  | abcde | app.example.com
  </code></pre>
  
  <p>If I am on app.example.com, PHP will only show me this in the <code>$_COOKIE</code> global array:</p>
  
  <pre><code>array("uid" =&gt; "abcde");
  </code></pre>
  
  <p>However, I want to be able to access this:</p>
  
  <pre><code>array("uid" =&gt; "12345");
  </code></pre>
  
  <p>Is this possible?</p>
  
  <p>I've tried using session_set_cookie_params like this:</p>
  
  <pre><code>session_set_cookie_params(0, "/", ".example.com");
  session_start();
  echo "&lt;pre&gt;"; print_r($_COOKIE["uid"]); echo "&lt;/pre&gt;";
  </code></pre>
  
  <p>But it still returns:</p>
  
  <pre><code>array("uid" =&gt; "abcde");
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>The cookies are being set with the following code:</p>
  
  <pre><code>setcookie("uid", "12345", 0, "/", "example.com");
  setcookie("uid", "abcde", 0, "/", "app.example.com");
  </code></pre>