生成大随机数php [英] Generate BIG random number php

查看:43
本文介绍了生成大随机数php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 PHP 生成一个 75 个字符的数字.

I want to generate a number with 75 characters using PHP.

我到处搜索,除了这个:http://dailycoding.com/tools/随机数.aspx

I have searched everywhere and got nothing, except for this: http://dailycoding.com/tools/RandomNumber.aspx

我不认为从那个页面抓取它是有效的.

I do not think it is effective to grab it from that page.

我尝试过的是:

rand(1,9999999999999999999999999999999999999);

推荐答案

试试这个

function bigNumber() {
    # prevent the first number from being 0
    $output = rand(1,9);

    for($i=0; $i<74; $i++) {
        $output .= rand(0,9);
    }

    return $output;
}

这篇关于生成大随机数php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆