reeksy
11-30-2005, 05:33 PM
Hi
How do you create an array from a while loop? Basically i want to list out all the files within a directory (below)
$dh = opendir($img_dir_1);
while($file = readdir($dh)){
if ($file != '.' && $file != '..' && $file != 'Thumbs.db'){
print ($file)."<br>";
}
}
Then i want to build each $file into an array and randomly select one using the array_rand() function.
However im unsure on how to build my array around the while loop!?!
Thanks for any help!
How do you create an array from a while loop? Basically i want to list out all the files within a directory (below)
$dh = opendir($img_dir_1);
while($file = readdir($dh)){
if ($file != '.' && $file != '..' && $file != 'Thumbs.db'){
print ($file)."<br>";
}
}
Then i want to build each $file into an array and randomly select one using the array_rand() function.
However im unsure on how to build my array around the while loop!?!
Thanks for any help!