iterator_apply
iterator_to_array
SPL Functions
PHP Manual

# iterator_count

(PHP 5 >= 5.1.0)

iterator_count — Count the elements in an iterator

### Description

int iterator_count ( Traversable `$iterator` )

Count the elements in an iterator.

### Parameters

`iterator`

  The iterator being counted.

### Return Values

The number of elements in `iterator`.

### Examples

Example #1 iterator_count() example

`<?php
$iterator = new ArrayIterator(array('recipe'=>'pancakes', 'egg', 'milk', 'flour'));
var_dump(iterator_count($iterator));
?>`

The above example will output:

    int(4)

iterator_apply
iterator_to_array
SPL Functions
PHP Manual