title: Setting HTTP response status code in PHP using header('HTTP/1.1 <status-code>')?
body: <p>I mostly see the response code being set like this:</p>
  <pre><code>header('HTTP/1.1 404 Not Found');
  </code></pre>
  <p>But the below also seems to work fine</p>
  <pre><code>header('HTTP/1.1 404');
  </code></pre>
  <p>wanted to know if it absolutely necessary to specify the status code description like <code>OK</code>, <code>Not Found</code> etc. I would like to avoid specifying since my status code is a variable and I would need to maintain a table of some sort mapping every single status code to the status code description. Please find the the code I am using below.</p>
  <pre><code>$status = 404; //or any other response code
  $protocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0');
  header($protocol.&quot; $status&quot;);
  </code></pre>
  <p>Appreciate any help.</p>