title: PHP cookie set in second refresh page
body: <p>i want to use <code>cookie</code> in web page and i want to use it for save any optional variables. but after use <code>setcookie</code> and refresh page <code>isset()</code> could not detect, i must be many refresh page for use it,</p>
  
  <p>i cant use it in first refresh or visit page.</p>
  
  <p><strong>PHP:</strong></p>
  
  <pre><code>setcookie("user", "Alex Porter", time()+3600);
  if (isset($_COOKIE["user"]))
    echo "Welcome " . $_COOKIE["user"] . "!&lt;br&gt;";
  else
    echo "Welcome guest!&lt;br&gt;";
  
  //unset($_COOKIE['user']);
  //setcookie('user', '', time() - 3600); 
  </code></pre>
  
  <p><strong>RESULT:</strong></p>
  
  <p>after save and refresh page</p>
  
  <pre><code>Welcome guest!
  </code></pre>
  
  <p>second refresh :</p>
  
  <pre><code>Welcome Alex Porter
  </code></pre>