Very small yet wow kind of script that takes a folder and displays random script image at every time page reloads.

PHP Code

<?php
$files = glob("images/*.*");
mt_srand( (double) microtime() * 1000000 );
$num = mt_rand(0, count($files)-1);
echo '<img src="'.$files[$num].'" alt="" />';
?>

In this example ‘images’ is the folder containing all the images. Every time page reloads, it will display different image.

Random Single Image On Page Reload PHP Script Download

  • Share/Bookmark

, , ,