I have the following script. I want to read a directory, and display an image at random from the contents of the directory.
Its not working and i am confused. Help!
<?
$list=opendir('test');
while (false!==($file = readdir($list)))
{
if ($file != "." && $file != "..")
{
$images[] = $file;
}
}
$arraysize=count ($images);
$random = rand (1, $arraysize);
$displaypic=$image[$random];
echo ($displaypic);
?>