add correction

This commit is contained in:
JARNOUEN DE VILLARTAY Ulysse (SAFRAN AIRCRAFT ENGINES)
2026-04-02 13:48:28 +02:00
parent eb2d8315f9
commit 6dd596e7b3
5 changed files with 113 additions and 55 deletions
+6 -6
View File
@@ -1,9 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<body> <body>
<?php <?php
echo "<h1>hello world !!!</h1>"; echo "<h1>hello world !!!</h1>";
//phpinfo(); phpinfo();
?> ?>
</body> </body>
</html> </html>
+34 -9
View File
@@ -1,17 +1,19 @@
<?php <?php
$clients = [ $clients = [
"Luc", "Luc",
7 => "Paul", 7 => "Paul",
2 =>"Martin", 2 =>"Martin",
"Arnaud" "Arnaud"
]; ];
var_dump($clients);
$produits = [ $produits = [
20 => "Chemise", 20 => "Chemise",
3 => "Pantalon", 3 => "Pantalon",
10 => "Jupe", 10 => "Jupe",
"Veste", "Veste",
"Blouson" "Blouson"
]; ];
$array = ["a","b","c"]; $array = ["a","b","c"];
$array[] = "d"; $array[] = "d";
@@ -23,4 +25,27 @@ print_r($clients);
print_r($produits); print_r($produits);
print_r($array); print_r($array);
echo "</pre>"; 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>";
}
?> ?>
+48 -31
View File
@@ -3,36 +3,53 @@ include './include/data.inc.php';
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>tp1 - ex3</title> <title>tp1 - ex3</title>
<link <link
rel="stylesheet" rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.classless.min.css"
> >
<link rel="stylesheet" href="./css/style.css"> <link rel="stylesheet" href="./css/style.css">
</head> </head>
<body> <body>
<main> <main>
<h2>Exercice 3 : IMC </h2> <h2>Exercice 3 : IMC </h2>
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Nom</th> <th>Nom</th>
<th>Prénom</th> <th>Prénom</th>
<th>Email</th> <th>Email</th>
<th>Taille</th> <th>Taille</th>
<th>Poids</th> <th>Poids</th>
<th>IMC</th> <th>IMC</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php include_once './include/data.inc.php'; ?>
<?php foreach ($data as $person) : ?>
<?php
$poids = (float) $person['Poids'];
$tailleM = (float) $person['Taille'] / 100;
<!-- À compléter --> $imc = null;
if ($tailleM > 0) {
</tbody> $imc = $poids / ($tailleM * $tailleM);
</table> }
</main> ?>
</body> <tr class="<?= $imc < 18.5 ? 'underweight' : ($imc < 25 ? 'normal' : 'warning') ?>">
<td><?= $person['Nom'] ?></td>
<td><?= $person['Prenom'] ?></td>
<td><?= $person['Email'] ?></td>
<td><?= $person['Taille'] ?></td>
<td><?= $person['Poids'] ?></td>
<td><?= round($imc, 2) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</main>
</body>
</html> </html>
+20 -4
View File
@@ -1,3 +1,19 @@
<?php
// Generate random values for two six-sided dice.
$die1 = mt_rand(1, 6);
$die2 = mt_rand(1, 6);
$sum = $die1 + $die2;
// Map dice values to matching SVG filenames.
$diceImages = [
1 => 'dice-six-faces-one.svg',
2 => 'dice-six-faces-two.svg',
3 => 'dice-six-faces-three.svg',
4 => 'dice-six-faces-four.svg',
5 => 'dice-six-faces-five.svg',
6 => 'dice-six-faces-six.svg',
];
?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<head> <head>
@@ -13,12 +29,12 @@
</head> </head>
<body> <body>
<main> <main>
<h5><a href=""> Tirage aléatoire</a></h5> <h5><a href="./">Tirage aléatoire</a></h5>
<article class="is-center"> <article class="is-center">
<img src='./img/dice-six-faces-five.svg'> <img src="./img/<?= $diceImages[$die1] ?>" alt="Dé 1 : <?= $die1 ?>">
<img src='./img/dice-six-faces-one.svg'> <img src="./img/<?= $diceImages[$die2] ?>" alt="Dé 2 : <?= $die2 ?>">
</article> </article>
<h5>Somme = </h5> <h5>Somme = <?= $sum ?></h5>
</main> </main>
</body> </body>
</html> </html>
+4 -4
View File
@@ -1,7 +1,7 @@
<?php <?php
function createPassword($n,$alphabet){ function createPassword($n,$alphabet) {
$length = strlen($alphabet); $length = strlen($alphabet);
$password = ""; $password = "";
return $password; return $password;
} }
?> ?>