我有一个生成随机字符串的函数,我希望它生成超过1行的随机字符串

I have a Function to generate random string ,it produce more than 1 random string ,but how to separate them

    Function generatorstring($count) {

    $karakter = '0123456789abcdefghijklmnopqrstuvwxyz';
    $length = 7;
    $randomString = '';

    for ($i=0; $i <$count ; $i++) { 

        for ($ia = 0; $ia < $length; $ia++) {
            $randomString .= $karakter[rand(0, strlen($karakter) - 1)];
        }

    }

    return $randomString ;
}
echo generatorstring(3);

I expected result like this

'As6s8Xs',
'zE71jnM', 
'ak9a71b', 

But, its only produce 1 line of random string.

查看全部
douye2110
douye2110
2019/05/24 15:35
  • random
  • php
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

2个回复