title: Getting undefined function using http_response_code
body: <p>I'm doing a form validator ( among other things ) and I've set a response code in my script so I can use AJAX.. for some wierd reason it's throwing this error when I execute the script:</p>
  
  <blockquote>
    <p><strong>Fatal error</strong>: Call to undefined function http_response_code()</p>
  </blockquote>
  
  <p>My script:</p>
  
  <pre><code>if ($_SERVER["REQUEST_METHOD"] == "POST"){
      $email = filter_var(trim($_POST['email'],FILTER_SANITIZE_EMAIL));
      $code = trim($_POST['code']);
  
      if (!filter_var($email, FILTER_VALIDATE_EMAIL) OR empty($code)){
          http_response_code(400);
          echo "Oops! There was a problem with your submission. Try again!";
          exit;
      }
  
      if(!$conn) die("Something wrong happened" . mysql_error());
  
      if(mysql_query($sql,$conn)){
  
          if(isset($_POST['newsletter'])){
              $MailChimp = new MailChimp();
              $list_id = '*********';
              $user_info = array('email_address' =&gt; $email,'status' =&gt; 'subscribed');
              $result = $MailChimp-&gt;post("lists/$list_id/members",$user_info);
  
              if(strpos($MailChimp-&gt;getLastError(), 'is already a list member') !== false) echo 'You are already subscribed, smarty pants!';
          }
  
          http_response_code(200);
          echo "Thank you!";
      }
  
      else{
         http_response_code(500);
         echo "Oops! Something went wrong";
      }
  
         if(!mysql_query($sql,$conn)) echo "&lt;p&gt;" . "There seems to be a problem :&lt; ... Please check the info you provided and try again!" . "&lt;/p&gt;";
         else echo "&lt;p&gt;" . "Much thanks! Very wow :D" . "&lt;/p&gt;";
         mysql_close($conn);
  }
  </code></pre>
  
  <p>Anyone has a clue on what could be going on or a better way to do this? </p>