18.221.146.223 |    

Navigation

Google Advertisement

This generate a random string of 36 characters.

get_random_string
  1. // $string = get_random_string( 36 );
  2. //
  3. // This generate a random string of 24 characters.
  4. //
  5. // $string = get_random_string();
  6.  
  7. // *****************************************************************
  8. // This function generate a random string of $count length.
  9. // The default length is 24.
  10.  
  11. function get_random_string ( $count = 24 ) {
  12.  
  13. srand(time());
  14. (array) $random = array_merge( range( 0, 9 ), range( 'A', 'Z' ), range( 'a', 'z' ) );
  15. for ( (int) $i=0; $i<=$count; $i++ ) {
  16. 	(int) $rand=(int)(rand(0,count($random)));
  17.     (string) $str.=$random[$rand]; 
  18. }
  19. return $str;
  20.  
  21. }
Parsed in 0.012 seconds at 46.26 KB/s

Search
 
Full text search by name and content of a snippet.

User online
There are 4 users online.

Tags Cloud

Latest snippets
str2seconds
(Bash::Function)
is_integer
(Bash::Function)
file_rotate
(Bash::Function)
confirm
(Bash::Function)
is_workingtime
(Bash::Function)
last day of last month
(Bash::Snippets)
crypt_apr1_md5
(PHP::Function)
crypt_apr1_md5
(Perl::Function)
transparent
(CSS)
rfc2822Toiso8601
(PHP::Function)