Revision: 67553
Updated Code
at October 6, 2014 05:53 by ulfinger
Updated Code
<?php
$zahlen1 = range(1, 49); # Zahlenreihe erzeugen
shuffle($zahlen1); # Hauptzahlenreihe mischen
$lose = array_chunk($zahlen1, 6); # Aufteilung in 9 Tipps, der letzte hat nur eine Zahl
$rest = $lose[8][0]; # restliche Zahl im letzten Los
$zahlen2 = $zahlen1; # 2. Zahlenreihe wird erzeigt
unset($zahlen2[48]); # Restzahl aus 2. Zahlenreihe entfernen
shuffle($zahlen2); # Mischen 2. Zahlenreihe
$block = array_chunk($zahlen2, 5); # Ergänzungszahlen werden in 5er-Blöcke geteilt
$blocknr = rand(0, 8); # zufallszahl legt fest, welcher Block zur Ergänzung verwendet wird
$tipp9 = $block[$blocknr]; # Tipp 9 besteht aus den 5 Ergänzugszahlen und der Restzahl
array_push($tipp9, $rest); # Restzahl wird Tipp 9 angefügt
sort($tipp9);
$tipp = array();
$tiptx = array();
$tiptx[9] = implode(", ", $tipp9);
$tippzahl = 1;
while ($tippzahl <= 8){
$tipp[$tippzahl] = $lose[($tippzahl -1)];
sort($tipp[$tippzahl]);
$tiptx[$tippzahl] = implode(", ", $tipp[$tippzahl]);
$tippzahl++;
}
$super = rand(0, 9);
$text = '<b>Vorschlag Lottotipps:</b>';
$text .= '<form action="/tools/lottospeichern.php" method="post">';
$zaehler = 1;
while($zaehler <= 9){
$text .= '<p>'.$zaehler.'. Tipp: '.$tiptx[$zaehler].'<input type="hidden" name="tip'.$zaehler.'" value="'.$tiptx[$zaehler].'"/></p>';
$zaehler++;
}
$text .= '<p>Superzahl: '.$super.'</p>';
$text .= '<input type="submit" value="Tipps speichern" />';
$text .= '</form>';
echo $text;
?>
Revision: 67552
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 5, 2014 08:02 by ulfinger
Initial Code
<?php
$zahlen1 = range(1, 49); # Zahlenreihe erzeugen
shuffle($zahlen1); # Hauptzahlenreihe mischen
$lose = array_chunk($zahlen1, 6); # Aufteilung in 9 Tipps, der letzte hat nur eine Zahl
$rest = $lose[8][0]; # restliche Zahl im letzten Los
$zahlen2 = $zahlen1; # 2. Zahlenreihe wird erzeigt
unset($zahlen2[48]); # Restzahl aus 2. Zahlenreihe entfernen
shuffle($zahlen2); # Mischen 2. Zahlenreihe
$block = array_chunk($zahlen2, 5); # Ergänzungszahlen werden in 5er-Blöcke geteilt
$blocknr = rand(0, 8); # zufallszahl legt fest, welcher Block zur Ergänzung verwendet wird
$tipp9 = $block[$blocknr]; # Tipp 9 besteht aus den 5 Ergänzugszahlen und der Restzahl
array_push($tipp9, $rest); # Restzahl wird Tipp 9 angefügt
sort($tipp9);
$tipp1 = $lose[0];
sort($tipp1);
$tipp2 = $lose[1];
sort($tipp2);
$tipp3 = $lose[2];
sort($tipp3);
$tipp4 = $lose[3];
sort($tipp4);
$tipp5 = $lose[4];
sort($tipp5);
$tipp6 = $lose[5];
sort($tipp6);
$tipp7 = $lose[6];
sort($tipp7);
$tipp8 = $lose[7];
sort($tipp8);
$super = rand(0, 9);
$text = '<b>Lottotipps:</b><p>';
$text .= '1. Tipp: ';
foreach($tipp1 as $reihe1){ $text .= "$reihe1, "; }
$text .= '<br/>2. Tipp: ';
foreach($tipp2 as $reihe2){ $text .= "$reihe2, "; }
$text .= '<br/>3. Tipp: ';
foreach($tipp3 as $reihe3){ $text .= "$reihe3, "; }
$text .= '<br/>4. Tipp: ';
foreach($tipp4 as $reihe4){ $text .= "$reihe4, "; }
$text .= '<br/>5. Tipp: ';
foreach($tipp5 as $reihe5){ $text .= "$reihe5, "; }
$text .= '<br/>6. Tipp: ';
foreach($tipp6 as $reihe6){ $text .= "$reihe6, "; }
$text .= '<br/>7. Tipp: ';
foreach($tipp7 as $reihe7){ $text .= "$reihe7, "; }
$text .= '<br/>8. Tipp: ';
foreach($tipp8 as $reihe8){ $text .= "$reihe8, "; }
$text .= '<br/>9. Tipp: ';
foreach($tipp9 as $reihe9){ $text .= "$reihe9, "; }
$text .= '<br/>Superzahl: '.$super;
$text .= '</p>';
echo $text;
?>
Initial URL
Initial Description
Es werden 9 Tipps generiet, bei denen jede der 49 Zahlen wenigstens ein mal getippt wird.
Initial Title
Lottozahlengenerator 6 aus 49
Initial Tags
Initial Language
PHP