Skip to content

Instantly share code, notes, and snippets.

@viniciusss
Created July 28, 2015 19:37
Show Gist options
  • Save viniciusss/3c1dbf105d0c5ca13204 to your computer and use it in GitHub Desktop.
Save viniciusss/3c1dbf105d0c5ca13204 to your computer and use it in GitHub Desktop.
<?php
if(isset($_REQUEST['conteudo'])) {
$notas = [];
$lista = explode(PHP_EOL, $_REQUEST['conteudo']);
$contador = 0;
foreach($lista as $nota) {
$dados = explode(' ', $nota);
$valorNota = end($dados);
if($valorNota < '67'){
continue;
}
$notas[$valorNota . $contador] = [
'nome' => $dados[1],
'nota' => str_replace(',', '.', $valorNota),
];
$contador++;
}
printf('Quantidade maiores que Frank %d', count($notas));
krsort($notas);
echo '<table border=1><thead><tr><th>Posicao</th><th>Quem?</th><th>Nota</th><thead><tbody>';
$posicao = 1;
foreach($notas as $nota) {
printf('<tr><td>%d</td><td>%s</td><td>%s</td></tr>', $posicao, $nota['nome'], $nota['nota']);
$posicao++;
}
//var_dump(array_values($notas));
echo '</tbody></table>';
}
?>
<html>
<body>
<form action="ordernar.php" method="post">
<textarea name="conteudo"></textarea>
<input type="submit" />
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment