Skip to content

Instantly share code, notes, and snippets.

@klaussilveira
Created June 1, 2011 18:34
Show Gist options
  • Save klaussilveira/1002961 to your computer and use it in GitHub Desktop.
Save klaussilveira/1002961 to your computer and use it in GitHub Desktop.
Sorteio 4Linux
#!/usr/bin/php
<?php
if (isset($argv[1])) {
$lista = file($argv[1]);
$total = count($lista) - 1;
echo $lista[mt_rand(1, $total)];
} else {
echo "Passe uma lista de nomes como parâmetro!";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment