25 Februari 2014

Function Generate Random Code

function generateRandomCode($length = 8) {
// Available characters
$chars = '0123456789abcdefghjkmnoprstvwxyz';

$Code = '';
// Generate code
for ($i = 0; $i < $length; ++$i) {
$Code .= substr($chars, (((int) mt_rand(0, strlen($chars))) - 1), 1);
}
return strtoupper($Code);
}

Tidak ada komentar:

Posting Komentar