Funcții SPL
PHP Manual

iterator_count

(PHP 5 >= 5.1.0)

iterator_countCount the elements in an iterator

Descrierea

int iterator_count ( Traversable $iterator )

Count the elements in an iterator.

Parametri

iterator

The iterator being counted.

Valorile întoarse

The number of elements in iterator.

Exemple

Example #1 iterator_count() example

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

Exemplul de mai sus va afișa:

int(4)


Funcții SPL
PHP Manual