The following is an introduction to two program codes for randomly generating a set of non-repeating numbers in PHP. Friends who need to learn can refer to them.
The code is as follows
|
Copy code
|
||||
/** * PHP gets a set of random numbers without repetition*/ $a = microtime();function createRandID($m){ // Generate an array from 1 to $m$arr = range(1,$m); //Shuffle the array
// Take the first ten for($i=0;$i<=10;$i++){
// Assign a value to the new array $ n Return implode($n,','); }
'; echo $a - microtime(); ?>Execution result:
Previous article:PHP recursive directory traversal implementation program_PHP tutorial
Next article:Commonly used PHP various verification regular expression programs_PHP tutorial
Statement of this Website
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
Latest Articles by Author
Latest Issues
Group MySQL results by ID for looping over
I have a table with flight data in mysql. I'm writing a php code that will group and displ...
From 2024-04-06 17:27:56
0
1
406
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|