debug 2.0

Colori Random

[ php ]

Piccolo script per generare colori html (esadecimali):
$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];
}
}


« torna ai tips

Sondaggio

Internet Mobile...





Ads

Web News

Friends

Makpaolo
Piero Ricca.org
tutorialweb
AG web wolutions
Ceptive
Jam

Bookmarks