I have an array I\'m getting back from scandir, but it contains \".\" and \"..\" and I don\'t want it to.
My code:
$indir =
I am aware erknrio provided an answer for this, but here is a cleaner way of getting an array of files without directories (modified to be more efficient):
$dirPath = 'dashboard';
$dir = scandir($dirPath);
foreach($dir as $index => &$item)
{
if(is_dir($dirPath. '/' . $item))
{
unset($dir[$index]);
}
}
$dir = array_values($dir);