Re: Random number generator
| From: | TG | Date: | Wed, 05 Nov 2008 19:01:43 +0000 |
| Subject: | Re: Random number generator | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-282944@lists.php.net to get a copy of this message | ||
Here's how you generate a random number:
http://us.php.net/manual/en/function.rand.php
There are a number of things you can do with that to select a random file and
include it. Have an associative array where the random number matches an
array key and the value is the filename you want, is one method.
Just starting out with PHP or is this a homework assignment? :)
-TG
----- Original Message -----
From: "WEISD" <pzig@weisd.com>
To: php-general@lists.php.net
Date: Wed, 5 Nov 2008 12:41:21 -0600
Subject: [PHP] Random number generator
>
> On a php web page I want to generate a random number between say 1 and 10
> and then use that number to reference a particular file in an include tag.
>
> <?php include('GeneratedNumber.html'); ?>
>
> Is there an easy way to do this?
>
> Thanks