Widget HTML Atas

Random PHP Code with Capital, Text and Number


<?php
function createRandomPassword($long=4) {
    $charsL = "abcdefghijklmnopqrstuvwxyz";
$charsU = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$int = "0123456789";
    srand((double)microtime()*1000000);
    $i = 1;
    $pass = '' ;
$randStart = rand(1,3);
    while ($i <= $long) {
   
if ($randStart == 1){
$num = rand() % 26;
$tmp = substr($charsL, $num, 1);
}
if ($randStart == 2){
$num = rand() % 26;
$tmp = substr($charsU, $num, 1);
}
if ($randStart == 3){
$num = rand() % 10;
$tmp = substr($int, $num, 1);
}
        $pass = $pass . $tmp;
if ($randStart <= 2 )
$randStart = $randStart +1;
else
$randStart = $randStart -2;
        $i++;
    }
    return $pass;
}
echo createRandomPassword();  // 

No comments for "Random PHP Code with Capital, Text and Number"

Search Results Computer Programing, technological, Data Appears, RiskTool, games, memory, MIPS Computer Programing, technological, Data Appears, RiskTool, games, memory, MIPS