Re: Random HTML
| From: | Ignacio Vazquez-Abrams | Date: | Fri, 17 Nov 2000 18:09:48 +0000 |
| Subject: | Re: Random HTML | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-25931@lists.php.net to get a copy of this message | ||
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.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>