PHP Array: loop through an array and choose a random element?
PHP makes it simple to loop through array components using the
mt_rand() function, and just needs the code shown below:
There is also another method with shuffle() function:
If you find this solution useful, please share this link!
As an Amazon Associate I earn from qualifying purchases. This post may contain affiliate links which means I may receive a commission for purchases made through links.