RE: [PHP] Random Images with no duplicates?

From: Date: Fri, 16 Dec 2005 14:10:17 +0000
Subject: RE: [PHP] Random Images with no duplicates?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-227538@lists.php.net to get a copy of this message
Hi, Just unset the ones you've picked <?php #random images example #this is your file $file = "images.txt"; #open the file $openFile = file($file); #generate a random number srand((double)microtime()*1000000); #get one of the entries in the file for ($i = 0; $i < 10; ++$i) { $r = array_rand($openFile); $random_image = $openFile[$r]; echo "<img src='$random_image' height='170' width='100'></img>"; unset($openFile[$r]); } ?> Jared

« previous php.general (#227538) next »