diff --git a/reference/spl/functions/iterator-count.xml b/reference/spl/functions/iterator-count.xml index d839324d21..d2b117416a 100644 --- a/reference/spl/functions/iterator-count.xml +++ b/reference/spl/functions/iterator-count.xml @@ -14,6 +14,8 @@ Count the elements in an iterator. + iterator_count is not guaranteed to retain the current + position of the iterator. @@ -57,6 +59,45 @@ var_dump(iterator_count($iterator)); + + + + <function>iterator_count</function> modifies position + +current()); +var_dump(iterator_count($iterator)); +var_dump($iterator->current()); +?> +]]> + + &example.outputs; + + + + + + <function>iterator_count</function> in &foreach; loops + + $value) { + echo "$key: $value (", iterator_count($iterator), ")\n"; +}?> +]]> + + &example.outputs; + +