Sending the HTTP Response Start Line in PHP
Using the header
function, you can
also send the start line of the
HTTP response. This is typically used
to specify the status.
Mainly for the 404
error:
<?php
header('HTTP/1.1 404 Not Found');
?>
Complete the code so that it sends
the 404
error header:
<?php
$arr = ['a', 'b', 'c'];
$key = $_GET['key'];
if (isset($arr[$key])) {
echo $arr[$key];
} else {
// send 404
echo 'error';
}
?>