Click to See Complete Forum and Search --> : How would I oput a random string of letters and #'s ?


Conor
07-24-2004, 09:16 PM
Like I know I would have

$string="a b c d e f g h i j k l m n o p q r s t u v w x y z";
$array=explode(" ",$string);

but how would I output 5 random characters from that array

sideshow
07-24-2004, 09:49 PM
http://www.phpfreaks.com/quickcode/Random_Password_Generator/56.php

96turnerri
07-25-2004, 05:31 AM
<?php

$string = "a b c d e f g h i j k l m n o p q r s t u v w x y z";
$array = explode(" ",$string);
$rand_keys = array_rand($array, 5);
$pass = $array[$rand_keys[0]] . $array[$rand_keys[1]] . $array[$rand_keys[2]] . $array[$rand_keys[3]] . $array[$rand_keys[4]];
echo $pass;

?>