I have several files in a folder and i want to count them.
$folder = "images";
$allPics = scandir($folder);
$result = sizeof($allPics);
The result is 350 but it should be 348. I don't get it why it is showing me the result +2?
Am i missing something?!
Best How To :
When looking at the documentation you can see the function return both '.' and '..', that's why you're having 2 more than you should have.
You can use this:
array_diff(scandir($folder), array('..', '.'));
To get rid of the dots you don't wanna have.