I want to select a random value from a array, but keep it unique as long as possible.
For example if I\'m selecting a value 4 times from a array of 4 elements, the s
Easy and clean:
$colors = array('blue', 'green', 'orange'); $history = $colors; function getColor($colors, &$history){ if(count($history)==0) $history = $colors; return array_pop( $history ); } echo getColor($colors, $history);