What does "line 10 in myfile.php" correspond to in your posting? The opendir() call? Or the readdir() call?
Also note proper use of readdir:
<?php
$handle=opendir('/path/to/files');
/ This is the correct way to loop over the directory. /
while (false !== ($file = readdir($handle))) {
echo "$file\n";
}
/ This is the WRONG way to loop over the directory. /
while ($file = readdir($handle)) {
echo "$file\n";
}
closedir($handle);
?>
(from http://www.php.net/manual/en/function.readdir.php)
And don't forget to close the file handle once you're done.