Forum Moderators: coopster
var3, var11, var5, var9, var12, var10
I want it to pull 6 out of the 12 and randomize them everytime the page is refreshed.
I keep running into the randomizing problem... I keep getting errors and only can get them to display this way.
var1, var2, var3, var4, var5, var6....
Any suggestions?
$ar=range(1,12); //created an array with values 1-12
shuffle($ar); // shuffles an array
for($i=1;$i<=6;$i++) { $ar2[]=${'val'.$ar[$i]}; } //creates additional array with 6 random elements from $valN
echo implode(',',$ar2); // prints it separated with comma
thought I had to make it 4 lines code because it should be separated with commas