$num = 50; // numero di colori da generare
for($i=0; $i<$num; $i++){
for($x=0; $x<3; $x++){
$rand = rand(0,255);
$hex[$x] = sprintf("%x",$rand);
if($rand < 9) {
$hex[$x] = "0".$hex[$x];
}
if($rand > 9 && $rand < 16) {
$hex[$x] = "0".$hex[$x];
}
}
if(!in_array('#'.$hex[0].$hex[1].$hex[2],$RandomColors)){
$RandomColors[] = '#'.$hex[0].$hex[1].$hex[2];
}
}