Return to Snippet

Revision: 10590
at January 5, 2009 09:53 by sveggiani


Initial Code
// name:      	evCreateRandomString
// version:	v0.1
// description: genera un string alfanumérico de X caracteres

function evCreateRandomString( $numChars = 6 ) {

	$chars = "abcdefghijkmnopqrstuvwxyz023456789";
	srand((double)microtime()*1000000);
	$i = 0;

	$string = '' ;

	while ( $i <= $numChars ) {
		$num = rand() % 33;
		$tmp = substr($chars, $num, 1);
		$pass = $pass . $tmp;
		$i++;
	}

	return $pass;

}

Initial URL

                                

Initial Description

                                

Initial Title
evCreateRandomString | generates a random alphanumeric string

Initial Tags

                                

Initial Language
PHP