i want to echo colors which will be selected from list, but they must be unique. I know how to generate unique things in general but don't have any idea on how to do that if there is a proper list.
also it must do this in a loop, that's why i did it with for loop below.
for example, in the starting, assume that array has 5 elements, and within the first loop it will select blue and echo that, after echoing the blue, in the second loop, there will be 4 options, it will echo one of the remaining four elements randomly, blue wont be in the options.
for instance, in my purpose it must generate like : blue - white - green - yellow - purple ( unique )
the false one is : blue - blue - green - yellow - purple ( not unique )
$colors= array('blue', 'green', 'yellow', 'purple', 'white');
for($i = 1; $i <=5; $i++){
echo $colors[array_rand($colors)];
}
shuffle()