50 lines
918 B
PHP
50 lines
918 B
PHP
<?php
|
|
|
|
$zaehler = 1 ;
|
|
$lotto = array();
|
|
const ENDE = 6;
|
|
|
|
$zahl = 0; //ab welchen element im array angefangen wird
|
|
|
|
do {
|
|
|
|
$r = rand(1,49);
|
|
|
|
if ($r == $lotto[0]) {
|
|
|
|
continue;
|
|
}
|
|
|
|
elseif ($r == $lotto[1]) {
|
|
|
|
continue;
|
|
}
|
|
|
|
elseif ($r == $lotto[2]) {
|
|
|
|
continue;
|
|
}
|
|
|
|
elseif ($r == $lotto[3]) {
|
|
|
|
continue;
|
|
}
|
|
|
|
elseif ($r == $lotto[4]) {
|
|
|
|
continue;
|
|
}
|
|
|
|
elseif ($r == $lotto[5]) {
|
|
|
|
continue;
|
|
}
|
|
|
|
$lotto[$zahl] = $r; // Schreibt die Randomzahl in das Array
|
|
|
|
$zahl++; //erhöht die Elemente im array um 1
|
|
|
|
$zaehler++; //erhöht den zähler ähler der schleife um 1
|
|
} while ($zaehler <= ENDE);
|
|
|
|
echo "<head><title>E2a Lottogenerator</title></head>\t\n<center><h1>Lottozahlen</h1>\t\n<p> Die Lottozahlen sind: <b>$lotto[0], $lotto[1], $lotto[2], $lotto[3], $lotto[4], $lotto[5]</b></p></center>"; |