PHP : Function Reference : Standard PHP Library (SPL) Functions : iterator_count
ard
Note that you that the iterator parameter doesn't need to be of type Aggregate. As the spl documentation on http://www.php.net/~helly/php/ext/spl/ defines it in the following way:
iterator_count (Traversable $it).
So you can count the number of files in a given directory quite easily:
<?php iterator_count(new DirectoryIterator('path/to/dir/')); ?>
|
|