title: php setcookie path and domain
body: <p>I am having a problem with setting cookie with php. I am trying to set a cookie <code>(id)</code> from <code>www.example.com/login.php</code> and I want to use from every place on the website. for example I want to use it in:</p>
  
  <pre><code>www.example.com/main.php
  www.example.com/users.php
  www.example.com/login.php
  </code></pre>
  
  <p>this is my php code</p>
  
  <pre><code>$expire = time() + 31556926;
  $cookie_id = $insert_userid;
  setcookie ("id");
  setcookie("id", $cookie_id, $expire, '/', 'www.example.com');
  </code></pre>
  
  <p>i do not have any subdomain. Also For the domain index in the setcookie function I am not sure which on to provide. <code>www.example.com or example.com</code></p>