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