You can use:
strpos
to find out if the name has dot (.
)
array_filter
to filter the array before iterating in the foreach
basename
to get only the file name
It would look something like:
<?php
$arquivos = array_filter(glob('*'), function ($path) {
return strpos(basename($path), '.') === false;
});
foreach ($arquivos as $arquivo) {
echo "$arquivo<br>";
}
Got it wrong, I removed this part:
You can use the pathinfo
thus:
<?php
$arquivos = glob("*");
foreach ($arquivos as $arquivo) {
$arquivo = pathinfo($arquivo, PATHINFO_FILENAME);
echo "$arquivo<br>";
}