forked from monnerat/web_2025
add correction
This commit is contained in:
parent
eb2d8315f9
commit
6dd596e7b3
@@ -3,7 +3,7 @@
|
||||
<body>
|
||||
<?php
|
||||
echo "<h1>hello world !!!</h1>";
|
||||
//phpinfo();
|
||||
phpinfo();
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -6,6 +6,8 @@ $clients = [
|
||||
"Arnaud"
|
||||
];
|
||||
|
||||
var_dump($clients);
|
||||
|
||||
$produits = [
|
||||
20 => "Chemise",
|
||||
3 => "Pantalon",
|
||||
@@ -23,4 +25,27 @@ 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>";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -28,9 +28,26 @@ include './include/data.inc.php';
|
||||
</tr>
|
||||
</thead>
|
||||
<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) {
|
||||
$imc = $poids / ($tailleM * $tailleM);
|
||||
}
|
||||
?>
|
||||
<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>
|
||||
|
||||
@@ -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>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
@@ -13,12 +29,12 @@
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h5><a href=""> Tirage aléatoire</a></h5>
|
||||
<h5><a href="./">Tirage aléatoire</a></h5>
|
||||
<article class="is-center">
|
||||
<img src='./img/dice-six-faces-five.svg'>
|
||||
<img src='./img/dice-six-faces-one.svg'>
|
||||
<img src="./img/<?= $diceImages[$die1] ?>" alt="Dé 1 : <?= $die1 ?>">
|
||||
<img src="./img/<?= $diceImages[$die2] ?>" alt="Dé 2 : <?= $die2 ?>">
|
||||
</article>
|
||||
<h5>Somme = </h5>
|
||||
<h5>Somme = <?= $sum ?></h5>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user