Home > Backend Development > PHP Tutorial > PHP randomly generates 10-digit character codes_PHP tutorial

PHP randomly generates 10-digit character codes_PHP tutorial

WBOY
Release: 2016-07-21 15:46:58
Original
869 people have browsed it

复制代码 代码如下:

function randStr($len)
{
$chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'; // characters to build the password from
$string='';
for(;$len>=1;$len--)
{
$position=rand()%strlen($chars);
$string.=substr($chars,$position,1);
}
return $string;
}
echo randStr(10)."
";


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/320028.htmlTechArticle复制代码 代码如下: function randStr($len) { $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'; // characters to build the password from $string=''; fo...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template