Zend - The PHP Company




Graphics

Add Code


Random Pic  

Type: code fragment
Added by: cre8or
Entered: 21/03/2000
Last modified: 08/12/1999
Rating: **** (12 votes)
Views: 9390
Simple php random picture, every time you reload the site it changes the picture. Simple but effective.


<html>
<TITLE> Random Pic  -- <> core.KAOTIK.org <> - </TITLE>
<body>

<?
    
/* random number generator */
    
Srand(date("s"));

    
/* 6 pictures, named 'pic0' to 'pic5' */
    
$n Rand() % 5;
   echo 
"<img src="pic$n" border="0" alt="random chosen pic">"
?>

</body>
</html>


Usage Example


See the example


Rate This Script





Search



This Category All Categories