if ( $dh = @opendir($pathToFile) )
{
while ( false !== ( $file = readdir($dh) ) )
In the above snippet from Zeb $dh will become a handle to the directory "$pathToFile".
The function readdir($directoryHandle) will return on each invocation a subdirectory of the directory $pathToFile. When there are no more directories to return the function returns false.
On a tidying up note the while loop checks for trueness (sorry for mangling the English language here). So the while loop could have been witten thus
while($file=readdir($dh))
{
... do some stuff
}
with the same results.