Exercice 3 : IMC
-| Nom | -Prénom | -Taille | -Poids | -IMC | -
|---|
| Nom | +Prénom | +Taille | +Poids | +IMC | +
|---|
diff --git a/R3.01/tp/tp1/ex1/hello-world.php b/R3.01/tp/tp1/ex1/hello-world.php index 11a784f..183c053 100644 --- a/R3.01/tp/tp1/ex1/hello-world.php +++ b/R3.01/tp/tp1/ex1/hello-world.php @@ -1,9 +1,9 @@ -
- hello world !!!"; - //phpinfo(); - ?> - + + hello world !!!"; + phpinfo(); + ?> + diff --git a/R3.01/tp/tp1/ex2/index.php b/R3.01/tp/tp1/ex2/index.php index 90e8baa..83fc42a 100644 --- a/R3.01/tp/tp1/ex2/index.php +++ b/R3.01/tp/tp1/ex2/index.php @@ -1,17 +1,19 @@ "Paul", - 2 =>"Martin", - "Arnaud" +$clients = [ + "Luc", + 7 => "Paul", + 2 =>"Martin", + "Arnaud" ]; +var_dump($clients); + $produits = [ - 20 => "Chemise", - 3 => "Pantalon", - 10 => "Jupe", - "Veste", - "Blouson" + 20 => "Chemise", + 3 => "Pantalon", + 10 => "Jupe", + "Veste", + "Blouson" ]; $array = ["a","b","c"]; $array[] = "d"; @@ -23,4 +25,27 @@ print_r($clients); print_r($produits); print_r($array); echo ""; + +// 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 ""; + for ($i = $debut; $i < $debut + 10; $i++) { + if ($i % 2 === 0) { + echo "$i "; + } else { + echo "$i "; + } + } + echo "
"; +} ?> diff --git a/R3.01/tp/tp1/ex3/index.php b/R3.01/tp/tp1/ex3/index.php index f031367..1dd90cd 100644 --- a/R3.01/tp/tp1/ex3/index.php +++ b/R3.01/tp/tp1/ex3/index.php @@ -1,38 +1,55 @@ - - - -| Nom | -Prénom | -Taille | -Poids | -IMC | -
|---|
| Nom | +Prénom | +Taille | +Poids | +IMC | +
|---|
+ Vous avez obtenu + + bonne(s) reponse(s) sur + . +
++ Questions repondues : + . +
++ Revenir au quizz +
++ Verbe : + +
-| Titre | -Année | -Genre | -Réalisateur | -
|---|---|---|---|
| Titre | +Année | +Genre | +Réalisateur | +{$film['titre']} | -{$film['annee']} | -{$film['genre']} | -{$film['prenom']} {$film['nom']} | - "; +foreach ($films as $film) { + $titre = htmlspecialchars($film['titre'], ENT_QUOTES, 'UTF-8'); + $annee = htmlspecialchars((string) $film['annee'], ENT_QUOTES, 'UTF-8'); + $genre = htmlspecialchars($film['genre'], ENT_QUOTES, 'UTF-8'); + $realisateur = htmlspecialchars($film['prenom'] . ' ' . $film['nom'], ENT_QUOTES, 'UTF-8'); + echo " +
| {$titre} | +{$annee} | +{$genre} | +{$realisateur} | +