php中的字符串可以当做数组调用

来源:互联网 发布:算法时间复杂性分析 编辑:程序博客网 时间:2024/06/05 00:50

php中的字符串可以当做数组调用

eg:

 <?php
$str1="abcdefghijklmnopqrstuvwxyz";
$str1=strtoupper($str1);

$str=$str1."1234567890";
$max=strlen($str);

$new="";

for($i=0;$i<4;$i++)
{
$new.=$str[rand(0,$max-1)];
}

echo $new;
?>

这也是生成随机字符的代码。








0 0
原创粉丝点击