PHP Random Image


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



Copy this code and paste it in your HTML
  1. <?php
  2.     $images=array('0.jpg','1.jpg','2.jpg');
  3.     $image=$images[array_rand($images)];
  4.     echo '<img src="path/to/'.$image.'" alt="Image: '.$image.'" />';
  5. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.