Mengirim Status Respons HTTP di PHP

Anda dapat mengatur status respons HTTP secara terpisah, tanpa menentukan baris awal. Ini dilakukan dengan menggunakan fungsi http_response_code:

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

Lengkapi kode sehingga status HTTP yang sesuai dikirimkan:

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