That's right the . .. are hidden fields. I used your code with slight mods and ran it on my system.
When I do counts like to return the totals from maybe a search it always seems to return one more record than it actually did. I'm sure it has to do with the for statement and a seasoned person may be able to help there but I usually just set a new variable when I print it out to set $idx=idx - 1. at the end of the loop. That's how I handle it.
I added an echo in there for you to print out the number it returns in the array before it loops through. The two print statements at the end I added so I could see the actual throughput (debugging steps).
Hope this helps. Oh, I also took out your $numfiles2 no need for it because you already have it in $numfiles. The "." in the opendir function just means the current directory that I stored the php file in.
<?
$dir = opendir(".");
while ($file[] = readdir($dir)) {}
$num_files = count ($file);
//find out if there are any hidden files by printing out $num_files
echo "$num_files";
print "<table border = 0 valign=center width=100%>
";
for ($idx = 0; $idx < $num_files; $idx++)
{
if ($idx < 0)
echo ("");
else
print "<td>$file[$idx]</td>";
print "<td>you have $idx file(s) in your folder</td></tr>";
}
?>