API With GET Parameter in PHP

Let's now make an API that will receive a parameter when accessed, and the response will be given depending on this parameter.

For example, let an integer be passed as a parameter:

urlhttp://api.loc/index.php?num=100

Let's return a random number in the range from one to the passed number in response:

api.loc/index.php<?php
  if (isset($_GET['num'])) {
    echo mt_rand(1, $_GET['num']);
  } else {
    echo 'error';
  }
?>
Задание 1

Create an API with an address, to which a date in the format year-month-day will be passed as a parameter, and in response the day of the week corresponding to that date will be returned.