Welcome to DevelNet, a code gallery for creating, saving and sharing all kinds of code snippets.

PHP — Random image

Posted On: Wednesday, January 14, 2015 at 7:36 PM

Show a random image
<?php
$images[] = 'image1.jpg';
$images[] = 'image2.jpg';
$images[] = 'image3.jpg';
echo '<img src="'.$images[rand(0,count($images)-1)].'" />';
?>