Posted By

contactpatbrown on 01/31/11


Tagged

php textmate random images


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

JoF


php random images with known names and locations


 / Published in: Other
 

  1. <?php
  2. $images = array(1=>1, 2, 3, 4, 5);
  3. for ($i= 0; $i < 3; $i++) {
  4. $nr[$i] = array_rand($images,1);
  5. unset($images[$nr[$i]]);
  6. ?>
  7. <img src="http://images_path/imagename_<?php echo $nr[$i] ?>.png" width='image_width' height='image_height' alt='image_alt_text' />
  8. <?php
  9. }
  10. ?>
  11.  

Report this snippet  

You need to login to post a comment.