title: Setting cookie using header("Set-cookie") vs setcookie() function
body: <p>I'm refactoring some code and found something I've never seen. the function is used for user to set cookie when user logs in:</p>
  
  <pre><code>  function setUserCookie($name, $value) {
       $date = date("D, d M Y H:i:s",strtotime('1 January 2015')) . 'GMT';
       header("Set-Cookie: {$name}={$value}; EXPIRES{$date};");
    }
  </code></pre>
  
  <p>now that I've been assigned to refactor code I'm planning to use <code>setcookie</code> function which essentially does same thing according to php.net.</p>
  
  <p>My question is: is there any difference between two and which one should I use?</p>
  
  <p>NOTE: this code was written long time ago so I'm assuming that at that time <code>setcookie</code> didnt exist?</p>