title: Preventing array_rand string duplicate in PHP
body: <p>I am randomizing php templates to include them in the web page. Each time the user reloads the web page, a new randomized template will appear.</p>
  
  <p>Problem with <code>array_rand</code> it returns one random string each time the user reloads the web page, and the same template may be displayed again and again. </p>
  
  <p>For example, let's say the user reloads the page 3 times. He may get the following templates:
  <code>template1.php, template1.php, template2.php</code></p>
  
  <p>I want the user to see all the templates in a random order. For example,
  <code>template3.php,template2.php,template1.php</code></p>
  
  <pre><code>$items = array("template1.php","template2.php","template3.php"); #templates array
  $a = $items[array_rand($items,1)]; #randomize templates
  
  include $a; #including randomized template
  </code></pre>