iterator_count

(PHP 5 >= 5.1.0RC1)

iterator_count --  Count the elements in an iterator

Description

int iterator_count ( IteratorAggregate iterator )

警告

本函数暂无文档,仅有参数列表。


add a note add a note User Contributed Notes
Ard
31-Aug-2006 06:39
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/'));    ?>