I have two arrays:
$array1 = array("red", "blue", "green", "yellow");
$array2 = array("one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten");
I want to randomly echo 10 times a color.
I tried to do it using foreach loop and shuffle, but when I try this I am getting the error:
Array to string conversion.....
This is my code:
shuffle($array1);
foreach($array2 as $array2) {
echo $array1;
}
Please can someone help me solving this problem?
$array2can increase or decrease? or it will be always 10?