To create a list of 5 random numbers in PHP, you can use the rand() function within a for loop to generate each number and store them in an array. Here's an example code block:
main.php285 chars8 lines
This code will iterate 5 times using a for loop and generate a random number between 1 and 100 with the rand() function. Each random number is appended to the $random_numbers array using the [] syntax. Finally, the print_r() function is used to output the entire array of random numbers.
gistlibby LogSnag