Re: Random HTML
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 17 Nov 2000 18:11:28 +0000 |
| Subject: | Re: Random HTML | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25933@lists.php.net to get a copy of this message | ||
On Fri, 17 Nov 2000, Ignacio Vazquez-Abrams wrote:
> On Fri, 17 Nov 2000, Richard Bradley wrote:
>
> > Does anyone have a script for presenting a different graphic or HTML everytime the page is
> > loaded. either from mysql or PHP functions?
> >
> > Thanks
> >
>
> Try:
>
> <?php
> $images=Array(
> "http://example.com/image1.gif",
> "http://example.net/image2.jpg",
> ...
> );
> ?>
> <img src="<?=$images[rand(0, count($images))]?>">
>
> The images should ideally all have the same width and height.
>
Sorry, that should be count(...)-1.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>