at random
so i have my script but for some reason, this is the outcome it gives me
0 -- . 0 -- . 0 -- U 55 -- 0 -- p
and teh script goes as follows
mt_srand(time());
$dir = "bwcars";
$odir = opendir($dir);
while (false !== ($index = readdir($odir))) {
$do = count($index);
for($counter=0; $counter < $index; $counter++) {
$pic = mt_rand(1, $counter);
$pic--;
}
echo "<font color=red>$counter -- ".$index[$pic]." </font>";
}
and if I echo out just $index it does do the files correctly and not give me all the weird mumbo jumbo i showed you above. and another problem I am having is that i wanna use closedir() and it isn't letting me after it'sbeen opened, after my while statement and that.
any thoughts? thanks alot.