Lista PHP de archivos específicos en un directorio
El siguiente código enumerará todo el archivo en un directorio
<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle)))
{
if (($file != ".")
&& ($file != ".."))
{
$thelist .= '<LI><a href="'.$file.'">'.$file.'</a>';
}
}
closedir($handle);
}
?>
<P>List of files:</p>
<UL>
<P><?=$thelist?></p>
</UL>
Si bien este es un código muy simple, hace el trabajo.
Ahora estoy buscando una manera de enumerar SOLAMENTE los archivos que tienen .xml (o .XML) al final, ¿cómo hago eso?