28 lines
584 B
PHP
28 lines
584 B
PHP
<?php
|
|
if (isset($_GET["nb"])) {
|
|
$nb = (int)$_GET["nb"];
|
|
if ($nb < 0 and $nb > 100)
|
|
$nb = null;
|
|
} else
|
|
$nb = null;
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Hello World 2</title>
|
|
</head>
|
|
<body>
|
|
<ul>
|
|
<?php
|
|
if ($nb !== null) {
|
|
for ($i = 0; $i < $nb; $i++) { ?>
|
|
<li>Hello World !</li>
|
|
<?php }
|
|
} else { ?>
|
|
<strong>Invalid number !</strong>
|
|
<?php } ?>
|
|
</ul>
|
|
</body>
|
|
</html>
|