note 37446 added to function.rand
| From: | jackylee at eml dot cc | Date: | Sat, 15 Nov 2003 15:18:31 +0000 |
| Subject: | note 37446 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60420@lists.php.net to get a copy of this message | ||
// is not a complete code but enough to random select background image.
// hope this can save your time :-)
<?php
srand ((double) microtime() * 1000000);
$randnum = rand(1,4);
$tempbackground = array(
"",
"wallpaper/WinXP.jpg",
"wallpaper/26033 Full moon gulls and surf.jpg",
"wallpaper/All White.jpg",
"wallpaper/xsport20_1024.jpg",
);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>calendar</title>
</head>
<body background="<?php echo $tempbackground[$randnum]; ?>"
text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF"
alink="#FFFFFF" style="background-attachment: fixed">
</body>
</html>
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37446
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37446&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37446&report=yes
Search -- http://master.php.net/manage/user-notes.php