Why is it when i use scandir using PHP i get extra values
$portID = $this->id;
$dir = '/home/sites/mydomain.com/public_html/public/images/'.$portID;
$contents = scandir($dir);
Is there something i dont know about the function which produces more values than are actually in the folder?
there’s nothing wrong with Pekka’s answer; I’ll just add a more declarative and mockable realization from SPL: