<?php
$clients = [
    "Luc",
    7 => "Paul",
    2 =>"Martin",
    "Arnaud"
];

var_dump($clients);

$produits = [
    20 => "Chemise",
    3 => "Pantalon",
    10 => "Jupe",
    "Veste",
    "Blouson"
];
$array = ["a","b","c"];
$array[] = "d";
$array[10] = "j";
unset($array[2]);

echo "<pre>";
print_r($clients);
print_r($produits);
print_r($array);
echo "</pre>";

// Exercice 2.1
$tab = [];
$somme = 0;
for ($i = 0; $i < 10; $i++) {
    $somme += $i; // somme des entiers de 0 à i
    $tab[$i] = $somme; // la clé i contient cette somme
}
print_r($tab);


// Exercice 2.2
for ($debut = 1; $debut <= 50; $debut += 10) {
    echo "<p>";
    for ($i = $debut; $i < $debut + 10; $i++) {
        if ($i % 2 === 0) {
            echo "<strong>$i</strong> ";
        } else {
            echo "<em>$i</em> ";
        }
    }
    echo "</p>";
}
?>
