We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

shamrog12 on 07/09/06


Tagged


Versions (?)


Who likes this?

6 people have marked this snippet as a favorite

luman
1man
panatlantica
Ernstladen
vali29
skywalker


PHP Random Image


Published in: PHP 


  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 

You need to login to post a comment.