php - rand() function that should not repeat -
i have code present 4 pictures folder. use rand()
function in order present each time different picture each 1 of these pictures, sometimes, receive same picture in same page. should in order not receive same picture twice?
i'd save possible images in array , shuffle it, this:
$images = array('1.png','2.png','3.png','4.png'); shuffle($images); foreach ($images $image) { // image }
Comments
Post a Comment