Home >Backend Development >PHP Tutorial >PHP generates a 15-digit random string

PHP generates a 15-digit random string

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-25 08:44:221402browse
  1. $metas = range(0, 9);
  2. $metas = array_merge($metas, range('A', 'Z'));
  3. $metas = array_merge($metas, range('a', 'z'));
  4. $str = '';
  5. for ($i=0; $i < 15; $i++) {
  6. $str .= $metas[rand(0, count($metas)-1)];
  7. }
  8. echo $str;
  9. ?>
复制代码

PHP


Statement:
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
Previous article:Unzip files using PHPZipNext article:Unzip files using PHPZip