PHP Taskbook Level 8.6

Задание 1

Given a menu with links. Color the link red if its address matches the URL in the browser address bar.

Задание 2

Given some URL:

php$url = 'http://test.com/dir1/dir2/dir3/page.html';

Get the contents of the first folder:

php'dir1'
Задание 3

Display the following pyramid on the screen:

xxxxx
xxxx
xxx
xx
x
Задание 4

Given a list of events for specific dates, stored in the following structure:

php<?php
  $events = [
    [
      'date' =>  '2019-12-29'
      'event' => 'name1'
    ],
    [
      'date' =>  '2019-12-31'
      'event' => 'name2'
    ],
    [
      'date' =>  '2019-12-29'
      'event' => 'name3'
    ],
    [
      'date' =>  '2019-12-30'
      'event' => 'name4'
    ],
    [
      'date' =>  '2019-12-29'
      'event' => 'name5'
    ],
    [
      'date' =>  '2019-12-31'
      'event' => 'name6'
    ],
    [
      'date' =>  '2019-12-29'
      'event' => 'name7'
    ],
    [
      'date' =>  '2019-12-30'
      'event' => 'name8'
    ],
    [
      'date' =>  '2019-12-30'
      'event' => 'name9'
    ],
  ]
?>

Write code that will remake the data structure into this:

php[
  '2019-12-29': ['name1', 'name3', 'name5', 'name7'],
  '2019-12-30': ['name4', 'name8', 'name9'],
  '2019-12-31': ['name2', 'name6'],
]