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

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -