views:

61

answers:

1

In the following code, what can be called instead of ->getFilename()?

<?php

foreach (new DirectoryIterator('../moodle') as $fileInfo) {
    if($fileInfo->isDot()) continue;
    echo $fileInfo->getFilename() . "<br>\n";
}

?>

PS, I have seen the documentation. Please don't link to here.

Thanks for the help.

EDIT:

After posting this I realized that the Docs had the answer. My real question becomes, what do the other methods do? The Docs seem to be limited in regards to that.

+2  A: 

EDIT: Oops misread your code. What exactly are you after instead of the filename? youve seen the docs so you know there are methods for both the full path (getPathname) and just the path to the containing dir (getPath)... Im not sure what you want here...

I assume you want the directory name of . or .. so to get that you could use getPath and then pop the last/second-to-last segment off or you could just use dirname($fileInfo->getPathname())

prodigitalson
It is too bad that we so often have to assume... Another answer could be: "Any other method of the $fileInfo object could be called instead of getFilename()."
Don
@Don, good point. I realized that after I posted the question.
Moshe