Created
September 7, 2016 01:02
-
-
Save FabianoCampos/a1e792a22d025a8cc4b6f0296e7bf4ff to your computer and use it in GitHub Desktop.
Conferir jogos lotofacil
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//ini_set('display_errors', true); | |
$numerosSorteados = [1,3,5,8,10,11,12,13,14,19,21,22,23,24,25]; | |
$h = fopen('lotofacil.txt', 'r'); | |
$acertos = []; | |
while (!feof ($h)) { | |
$linha = fgets($h, 4096); | |
if (trim($linha) === '') { | |
continue; | |
} | |
$apostados = explode(',', $linha); | |
array_walk($apostados, function (&$n, $key) { | |
$n = intval(trim($n)); | |
}); | |
$acertos[]= [ | |
'numeros'=> $linha, | |
'acertos' => count(array_intersect($apostados, $numerosSorteados)) | |
]; | |
} | |
fclose ($h); | |
echo "<table border=1><thead><tr><td>Jogo</td><td>Apostados</td><td>Acertos</td></tr></thead><tbody>"; | |
foreach ($acertos as $j => $info) { | |
echo '<tr><td>'.($j+1).'</td><td>'.$info['numeros'].'</td><td style="text-align:center;">'.$info['acertos'].'</td></tr>'; | |
} | |
echo "</tbody></table>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment