Re: um ... arrays
| From: | Stut | Date: | Thu, 21 Dec 2006 13:58:13 +0000 |
| Subject: | Re: um ... arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246122@lists.php.net to get a copy of this message | ||
Steven Macintyre wrote:
I have the following; $files = array(); $curimage=0; if($handle = opendir($dirname)) {1) Nowhere in that while loop do you add elements to the $files array. 2) Yes, that is what the shuffle function does, but it will have no effect on an empty array. -Stutwhile(false !== ($file = readdir($handle))){ if(eregi($pattern, $file)){$filedate=date ("M d, Y H:i:s", filemtime($file)); if(substr($file,-5)=='t.jpg') {echo 'leftrightslide[' . $curimage .']=\'<ahref="?file='.$file.'&c='.$cat.'"><img src="'.$dirname.'/'.$file.'" style="border:1px solid #bb3621"></a>\';' . "\n"; }$curimage++; } }closedir($handle);} shuffle($files); return($files); now ... why does files not get shuffled? Is that not the purpose of that function ?