Simple PHP Random Image
Simple way to mix elements of an array made with glob() & shuffle() functions:
<?php
function randomize() {
$pics = glob("*.jpg");
shuffle($pics);
return $pics[0];
}
echo '<img src="/images/' . randomize() . '.jpg" alt="" />';
?>
In this case the elements are JPEG files.

Leave a Reply
You must be logged in to post a comment.