A Conversation for Use PHP to get a random background colour for a website
Or you could do it this way.
.ashitaka Started conversation Feb 24, 2003
Here's yet another way to do it. ( most code is not changed, but some is. )
-------------begin HTML page----------
<?php
$c1 = "#ffffff";
$c2 = "#ffff99";
$c3 = "#00ccff";
$c4 = "#66ff99";
$c5 = "#ffcc00";
$c6 = "#d7ebff";
$c7 = "#ccffcc";
$colours = array();
$n=1;
while(isset(${"c$n"})){
$colours[] = ${"c$n"};
$n++;
}
$max = count($colours);
$number= rand(1,$max);
$bgcolour = ${"c$number"};
?>
colortest
<BODY bgcolor="<?=$bgcolour?>">
this is one of the c00l3r, l33t3r ways to do it.
-------------------end HTML page---
Key: Complain about this post
Or you could do it this way.
More Conversations for Use PHP to get a random background colour for a website
Write an Entry
"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."