Answers for "how to select 1 random value from associative array in php"

PHP
4

php get random value from array

$colors=["red","blue","green","orange"];
echo $colors[array_rand($colors)];//green (or any color randomly)
Posted by: Guest on June-02-2021

Code answers related to "how to select 1 random value from associative array in php"

Browse Popular Code Answers by Language