array_rand() function
Array_rand function is used to pick one or more elements from an array. We can use this function in sites to display random images.
Example :
<?php
srand ((float) microtime() * 10000000);
$input_array = array (”img1.jpg”, “img2.jpg”, “img3.jpg”, “img4.jpg”, “img5.jpg”);
$rand_keys = array_rand ($input_array, 2);
print $input_array[$rand_keys[0]].”\n”;
print $input_array[$rand_keys[1]].”\n”;
?>
In above example, we are picking 2 random images from input array.
