Re: Random number generator

From: Date: Wed, 05 Nov 2008 19:07:36 +0000
Subject: Re: Random number generator
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-282945@lists.php.net to get a copy of this message
Just starting out, thanks. So, <?php $number = rand(1, 10); include('$number.html'); ?> I should have prefaced the question with, New to PHP... ""TG"" <tg-php@gryffyndevelopment.com> wrote in message news:20081105.190143.665.1@MAINLINE...
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


« previous php.general (#282945) next »