PHP Function randomString() Random String Letters and Number
Create a Random String of Letters and Numbers that is [] Characters Long
Home
Short:
/* --------------------------------------- create random string of letters and numbers [$len] characters long --------------------------------------- */ function randomString($len) { $s = "abcdefghijklmnopqrstuvwxyz0123456789"; $max = (strlen($s) - 1); $out = ""; for($i = 0; $i < $len; $i++) { $rand = rand(0, $max); $out .= substr($s, $rand, 1); } return $out; }
source code home