Count the elements in an iterator

iterator_count

(PHP 5 >= 5.1.0)

iterator_countCount 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)


Customers Area | Contact us | Affiliates