PHP'de HTTP Yanıt Durumu Gönderme

Başlangıç satırını belirtmeden, HTTP yanıt durumunu ayrıca ayarlayabilirsiniz. Bu, http_response_code işlevi kullanılarak yapılır:

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

Kodu, ilgili HTTP durumlarının gönderileceği şekilde tamamlayın:

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