HTTP atsakymo statuso grąžinimas PHP

Galima atskirai nustatyti HTTP atsakymo statusą, nenurodant pradinės eilutės. Tai daroma naudojant funkciją http_response_code:

php<?php
  http_response_code(404);
?>
Задание 1

Užbaigite kodą taip, kad būtų grąžinami atitinkami HTTP statusai:

php<?php
  $arr = ['a', 'b', 'c'];
  
  if (isset($_GET['key'])) {
    $key = $_GET['key'];
    
    if (isset($arr[$key])) {
      echo $arr[$key];
    } else {
      // grąžinti 404
      echo 'Not Found';
    }
  } else {
    // grąžinti 403
    echo 'Forbidden';
  }
?>