fork(2) download
  1. <?php
  2.  
  3. function gerarCobinacao($tam){
  4. $seed = str_split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');
  5. shuffle($seed); // probably optional since array_is randomized; this may be redundant
  6. $rand = '';
  7. foreach (array_rand($seed, $tam) as $k)
  8. $rand .= $seed[$k];
  9.  
  10. return $rand;
  11. }
  12.  
  13. print gerarCobinacao(5);
Success #stdin #stdout 0.01s 82880KB
stdin
Standard input is empty
stdout
NmSsE