티스토리 뷰

참조 : http://bitwizx.tistory.com/72

특정 길이를 가지는 임의의 문자열을 생성하여 반환해 주는 함수이다.
필요에 따라 적당히 바꾸어 사용할 수 있을 듯.


< ?php
function GenerateString($length) {
   $characters  = "0123456789";
   $characters .= "abcdefghijklmnopqrstuvwxyz";
   $characters .= "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

   $string_generated = "";

   $nmr_loops = $length;
   while ( $nmr_loops-- ) {
      $string_generated .= $characters[mt_rand(0, strlen($characters))];
   }

   return $string_generated;
}
?>


Total
Today
Yesterday
최근에 올라온 글
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31