note 94847 deleted from function.readdir by danbrown

From: Date: Mon, 30 Nov 2009 13:08:05 +0000
Subject: note 94847 deleted from function.readdir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-163415@lists.php.net to get a copy of this message
Note Submitter: zak dot henry at gmail dot com ---- Here is a simplification of HeadRoom's image shuffle code <?php $image_dir = 'images/'; if ($handle = opendir($image_dir)) { $retval = array(); for ($count=0; $file = readdir($handle); $count++){ if (($file != ".") && ($file != "..")) { $retval[$count] = $file; } } closedir($handle); } shuffle($retval); $current_image = $retval[0]; ?>

« previous php.notes (#163415) next »