The method used to randomly obtain values from PHP arrays: array_rand()
##From the array Takes one or more random cells and returns one or more keys of the random entries.
But it uses a pseudo-random number generation algorithm, so it is not suitable for cryptography scenarios. (Recommended learning: PHP video tutorial)
Use array_rand() to randomly select units from the array
Print a random unit
Save and view the result
Other notes:
The above is the detailed content of How to get random values from array in php. For more information, please follow other related articles on the PHP Chinese website!