|
|
|
Tutorial pages:« 1 » |
|
wmikke
|
| Random - Posted on: 02-01-2005 at 14:29 | |

|
I taught: Come on Wmikke, write an article about rand(om).
Rand means random.
With random you can get something in random order.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
|
<?php
$backgroundnumber = rand(1,3);
IF ($backgroundnumber == 1) {
$background = "black";
}
ELSEIF ($backgroundnumber == 2) {
$background = "orange";
}
ELSE {
$background = "yellow";
}
?>
|
|
|
In the rule below you can say how many randoms you would like to use.
$backgroundnumber = rand(1,3);
You can see that there are three background colors.
1 = black
2 = orange
3 = yellow
You can use with this:
<body bgcolor="<? echo "$backgroundcolor"; ?>">
Now you have a random background color.
Ofcourse you can use it for more things 
For questions go to our forum
Greetz,
Wmikke
|
|
|
|
|