diff --git a/reference/spl/functions/ArrayIterator-key.xml b/reference/spl/functions/ArrayIterator-key.xml index f4daf487c1..11526973c7 100755 --- a/reference/spl/functions/ArrayIterator-key.xml +++ b/reference/spl/functions/ArrayIterator-key.xml @@ -1,5 +1,5 @@ - + ArrayIterator::key @@ -13,9 +13,26 @@ mixedArrayIterator::key + + This function returns the current array key + + + + <function>ArrayIterator::key</function> example + + 'value'); - &warn.undocumented.func; +$arrayobject = new ArrayObject($array); +$iterator = $arrayobject->getIterator(); +echo $iterator->key(); //key +?> +]]> + + + diff --git a/reference/spl/functions/ArrayIterator-next.xml b/reference/spl/functions/ArrayIterator-next.xml index 62ddf5f215..0e08756956 100755 --- a/reference/spl/functions/ArrayIterator-next.xml +++ b/reference/spl/functions/ArrayIterator-next.xml @@ -1,5 +1,5 @@ - + ArrayIterator::next @@ -13,9 +13,41 @@ voidArrayIterator::next + + This function moves the iterator to the next entry. + + + + <function>ArrayIterator::next</function> example + +getIterator(); + +while($iterator->valid()) { + echo $iterator->key() . ' => ' . $iterator->current() . "\n"; + + $iterator->next(); +} +?> +]]> + + + The above example will output: + + + zero +1 => one +]]> + + + diff --git a/reference/spl/functions/ArrayIterator-rewind.xml b/reference/spl/functions/ArrayIterator-rewind.xml index f2b26f4269..0493a4d19c 100755 --- a/reference/spl/functions/ArrayIterator-rewind.xml +++ b/reference/spl/functions/ArrayIterator-rewind.xml @@ -1,5 +1,5 @@ - + ArrayIterator::rewind @@ -13,9 +13,33 @@ voidArrayIterator::rewind + + This function rewinds the iterator to the begining. + + + + <function>ArrayObject::rewind</function> example + +getIterator(); + +$iterator->next(); +echo $iterator->key(); //1 + +$iterator->rewind(); //rewinding to the begining +echo $iterator->key(); //0 +?> +]]> + + +