Does anyone see anything wrong with the theory behind the code below?
I wrote this about a year ago when I was just learning PHP. Actually, I'm still not exactly a seasoned pro. I'm getting ready to include it in a script.
What I'm wondering is about the "for" loop. Typically the folder will have no more than about two files.
Does the "for" loop keep running after the one or two files have been identified? Are there any other problems with the way the script is written that anybody can see?
$OpenDir = opendir ($DirectoryPathName);
for ($i = 0; $i < count($DirectoryFile = readdir($OpenDir)); $i++) {
while (FALSE !== ($Files = readdir($OpenDir))) {
$FileToRead = $DirectoryPathName."/".$Files;
if (is_file($FileToRead)){
echo "the file is here<br>";
echo "".$FileToRead."<br>";
}
}
}
Thanks.