Titles in an Array in PHP

Let's now create a file where we will store page URLs and their corresponding titles in the form of an array:

titles.php<?php
  return [
    '/page1'         => 'page 1 title',
    '/dir/page2'     => 'page 2 title',
    '/dir/sub/page3' => 'page 3 title',
  ];
?>

On the page index.php, we will get the array of titles into a variable:

index.php<?php
  $titles = require 'titles.php';
?>

Let's get the title of the requested page:

php<?php
  $title = $titles[$url];
?>

Let's replace the corresponding command in the template file with our title:

php<?php
  $layout = str_replace('{{ title }}', $title, $layout);
?>
Задание 1

Implement titles stored in an array in your engine.