fork(1) download
  1. <?php
  2. function geraSenha(){
  3. //caracteres que serĂ£o usados na senha randomica
  4. $chars = 'abcdxyswzABCDZYWSZ0123456789';
  5. //ve o tamnha maximo que a senha pode ter
  6. $max = strlen($chars) - 1;
  7. //declara $senha
  8. $senha = null;
  9.  
  10. //loop que gerarĂ¡ a senha de 8 caracteres
  11. for($i=0;$i < 8; $i++){
  12. $senha .= $chars{mt_rand(0,$max)};
  13. }
  14. return $senha;
  15. }
  16. $i = 0;
  17. while($i < 10) {
  18. echo geraSenha() . "\n";
  19. $i++;
  20. }
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
xB0Y3Bxw
S0Yxd5bS
0Baas227
Sy1DCyxS
wZ64667z
0b7cCAdc
Y8Cwy8y1
SxxzWcD5
908Az82y
6B0ya515