Ask how to generate 500,000 non-repeating 8-digit Arabic numerals with PHP. How does the code write? Ask for help? Urgent. For complete code. Auto carriage return blank line: Thank you, seniors.
Reply to discussion (solution)
for ($i = 0; $i < 500000; $i + +)
for ($i = 10000000; $i < 10500000; $i + +)
for ($i = 10000000; $i < 10500000; $i + +)
You come here too?? You're not a regular water-mixing zone.
Do you work in PHP? Curious and own ....
Function Rand_num (& $num) {$n = rand (10000000,99999999), if (In_array ($n, $num)) {Rand_num (& $num);} return $n;} for ($i =0; $i <500000; $i + +) {$num [] = Rand_num (& $num);} Print_r ($num);
Reference 2 floor xming4321 reply: for ($i = 10000000; $i < 10500000; $i + +)
You come here too?? You're not a regular water-mixing zone.
Do you work in PHP? Curious and own .... I'm sending a yellow piece.
The 2 floor of the largest can only be 1049999, obviously does not meet the requirements.
4 floor is possible.
Is the 4 floor slow?
PHP code?1234567891011121314function rand_num (& $num) {$n = rand (10000000,99999999), if (In_array ($n, $num)) {Rand_ Num (& $num); } return $n;} for ($i =0; $i <500000;
Instantly the card is dead, but can solve the request, haha
Reference 4 Floor zhangbin1988 's reply: PHP code?1234567891011121314function rand_num (& $num) {$n = rand (10000000,99999999); if ( In_array ($n, $num)) {rand_num (& $num);
Do you want to cycle 50W can not slow it?
PHP code?1234567891011121314function rand_num (& $num) {$n = rand (10000000,99999999), if (In_array ($n, $num)) {Rand_ Num (& $num); } return $n;} for ($i =0; $i <500000;
Depressed. Questions about my PHP version? Call-time pass-by-reference has been removed!!!
Rand_num (& $num)
Change for
Rand_num ($num);
PHP 5.3, cannot explicitly pass a reference
Besides, your code is not properly written in its own right.
The 2 floor of the largest can only be 1049999, obviously does not meet the requirements.
4 floor is possible. You wrote one less.