- opendir: documentation ( source)
- closedir: documentation ( source)
- readdir: documentation ( source)
<?php
if ($dh = opendir('/etc/apache2/')) {
echo "Directory handle: $handle\n";
echo "Entries:\n";
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($dh))) {
echo "$entry\n";
}
closedir($dh);
}