Rotate image on page refresh


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. $rotate[] = "<img src='images/1.jpg' alt='' border='0' width='405' height='107' />";
  3. $rotate[] = "<img src='images/2.jpg' alt='' border='0' width='405' height='107' />";
  4. $rotate[] = "<img src='images/3.jpg' alt='' border='0' width='405' height='107' />";
  5. $rotate[] = "<img src='images/4.jpg' alt='' border='0' width='405' height='107' />";
  6.  
  7. $number = rand(0, sizeof($rotate) - 1);
  8.  
  9. echo $rotate[$number];
  10. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.