 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Generate array of random unique numbers in PHP?
For random unique numbers array, use range() along with shuffle().
Example
The PHP code is as follows
<!DOCTYPE html> <html> <body> <?php $limit_random_array_values = range(10, 20); shuffle($limit_random_array_values); $all_five_random_array_value = array_slice($limit_random_array_values ,0,5); print_r($all_five_random_array_value); ?> </body> </html>
Output
This will produce the following output
Array ( [0] => 11 [1] => 14 [2] => 15 [3] => 12 [4] => 18 )
Advertisements
 