不看后悔系列,技術(shù)大牛都是樂(lè)于分享和提攜后輩的,這也是能成為技術(shù)大牛的潛質(zhì)體現(xiàn)。
function yam($length){
$a="1234567890";
$b="qwertyuiopasdfghjklzxcvbnm";
$c="QWERTYUIOPASDFGHJKLZXCVBNM";
$d=$a.$b.$c;
for ($e=0;$e<$length;$e++){
//echo $d{mt_rand(1, strlen($d)-1)};
$f{$e}=$d{mt_rand(1, strlen($d)-1)};
}
return $f;
}
//yam(4);
$g=yam(4);
foreach ($g as $key=>$x){
echo $x;
}
$a="1234567890";
$b="qwertyuiopasdfghjklzxcvbnm";
$c="QWERTYUIOPASDFGHJKLZXCVBNM";
$d=$a.$b.$c;
for ($e=0;$e<$length;$e++){
//echo $d{mt_rand(1, strlen($d)-1)};
$f{$e}=$d{mt_rand(1, strlen($d)-1)};
}
return $f;
}
//yam(4);
$g=yam(4);
foreach ($g as $key=>$x){
echo $x;
}
2017-07-28
mt_rand與Rand區(qū)別,mt_rand執(zhí)行速度比rand快4倍
2017-07-28
講得很細(xì)致,很耐心,點(diǎn)贊king老師?。?!
2017-07-24
function getCode($length = 4) {
$varcode = "0123456789qwertyuiopasdfgjklzxcbnmvQWERTYUIOPASDLKFJHGZBXNCMV";
$relult = "";
for ($i = 0; $i < $length; $i++) {
$relult{$i} = $varcode{mt_rand(0,strlen($varcode))};
}
return $relult;
}
echo getCode();
$varcode = "0123456789qwertyuiopasdfgjklzxcbnmvQWERTYUIOPASDLKFJHGZBXNCMV";
$relult = "";
for ($i = 0; $i < $length; $i++) {
$relult{$i} = $varcode{mt_rand(0,strlen($varcode))};
}
return $relult;
}
echo getCode();
2017-07-11
$str2{1} = '' 輸出 報(bào)錯(cuò) Warning: Cannot assign an empty string to a string offset in E:\www\myself\string\index2.php on line 35
2017-06-13
學(xué)完啦,并實(shí)戰(zhàn)了一次,歡迎參觀!
http://fatxin.cn/?p=290
http://fatxin.cn/?p=290
2017-06-10