Cool piece of code: Have I understood it correctly (I realise this is not a 'learn PHP forum'

)
The line while (false !== ($entry = readdir($handle))) is astounding!
This is my interpretation of the snippet:
$dir = isset($dir) ? $dir : "."; If directory is set, fine, if not set it to '.' which means current directory
if ($handle = opendir('.')) { If the uninitialised variable $handle is = to current directory then:
while (false !== ($entry = readdir($handle))) { repeat while there is something to read in the directory
if ($entry != "." && $entry != "..") { if the directory reading is not . or ..
return "$entry\n"; send the entry
}
}
closedir($handle); close the directory opened earlier
}
Is this right?
I thought you had to write output to a variable first then output that variable with the return command, but it seems you can write output on the fly, so to speak.
Very interesting piece of code (for a humble amateur like myself).
Thanks for the snippet.
Paul