fork download
  1. <?php
  2. function getRandCode ($length="6",$num="5"){
  3. $str = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXXYZabcdefghijklmnopqrstuvwxyz';
  4. $coderows=array();
  5. for($k=0;$k<$num;$k++){
  6. $code="";
  7. for ($i = 0; $i < $length; $i ++) {
  8. $code .= $str{rand(0, 62)};
  9. }
  10. array_push($coderows,$code);
  11. }
  12. return $coderows;
  13. };
  14. $test =getRandCode();
  15. Print_r($test);
Success #stdin #stdout 0s 52488KB
stdin
Standard input is empty
stdout
Array
(
    [0] => YhLWSG
    [1] => EkB3dv
    [2] => o5rYXX
    [3] => bPXOKL
    [4] => X6RfEB
)