This is the random number : (Odd is red, Even is blue)
1 : 39
2 : 23
3 : 90
4 : 28
5 : 56
bye
|
<body bgcolor=#ffffff text=#000000>
<font face=arial size=0>
This is the random number :<br>
(Odd is red, Even is blue)<hr>
<font color=#ff0000>
<?
srand((double)microtime()*1000000);
for ($i=1 ; $i <= 5;$i++){
$v = rand(0,100);
$d = $v % 2;
if ($d == 0) { echo "<font color=#0000ff>"; }
echo $i ," : ",$v,"<br>";
if ($d == 0) { echo "</font>"; }
}
?>
<hr>
</font>
bye
</body>
- Click here เพื่อดูผลการประมวลผลจาก http://www.thaiall.com/php/tstrand.php
|