Madame Lou has gathered today's news. Gaston, the village constable, wrote two articles, and she wrote one herself. A page per story, by hand? No way: PHP knows how to repeat itself.
Your mission
- The articles are stored in the
$articlesarray. Add a fourth article to it, written on the same model as the other three: itstitre(title) is'The soup contest is open'and itsauteur(author) is'Odette'. - Inside
<main class="articles">, go through the array with aforeachloop. - For each article, print an
<article class="article">containing its title in an<h2>and its author in<p class="auteur">By Madame Lou</p>.
Reminder
An array stores several values in a single variable. An associative array stores them under keys: $article['titre']. Here, $articles is an array of arrays, and foreach visits each element, one by one, from first to last.
To add an element at the end of an existing array, there is also a short form: $articles[] = ['titre' => '…', 'auteur' => '…'];. The empty brackets mean “next in line”. You'll meet it again later, to fill an array inside a loop.
Notice that the article about the mayor's cat has its title in double quotes: "The mayor's cat is missing". That's because of the apostrophe: inside single quotes, it would end the string too early.