str_random

Custom PHP Function


function str_random($a = 8) { $b = NULL; $c = $d = NULL; for ($i = 0; $i < $a; $i++) { $c = chr(rand(48, 122)); while (!ereg("[a-zA-Z0-9]", $c)) { if ($c == $d) continue; $c = chr(rand(48, 90)); } $b .= $c; $d = $c; } return $b; }