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

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -