Remove file extensions using DirectoryIterator

0

I need a help, I'm listing files from some folders, but at the time of listing the file name appears completely, along with the file extension. I could not use the explode. How to proceed? Follow the code I'm using

$files = array();

$dir = new DirectoryIterator('caminho');

foreach ($dir as $fileinfo) {
 $files[$fileinfo->getFilename()] = $fileinfo->getFilename();
}

sort($files);

foreach($files as $file){
 echo "<a href="$file.">" .$file."</a>", "<br>";
}

Thanks in advance for your help!

    
asked by anonymous 30.05.2018 / 20:11

0 answers