Query: iterator_apply
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
ITERATOR_APPLY(3) 1 ITERATOR_APPLY(3) iterator_apply - Call a function for every element in an iteratorSYNOPSISint iterator_apply (Traversable $iterator, callable $function, [array $args])DESCRIPTIONCalls a function for every element in an iterator.PARAMETERSo $iterator - The class to iterate over. o $function - The callback function to call on every element. Note The function must return TRUE in order to continue iterating over the $iterator. o $args - Arguments to pass to the callback function.RETURN VALUESReturns the iteration count.EXAMPLESExample #1 iterator_apply(3) example <?php function print_caps(Iterator $iterator) { echo strtoupper($iterator->current()) . " "; return TRUE; } $it = new ArrayIterator(array("Apples", "Bananas", "Cherries")); iterator_apply($it, "print_caps", array($it)); ?> The above example will output: APPLES BANANAS CHERRIESSEE ALSOarray_walk(3). PHP Documentation Group ITERATOR_APPLY(3)
Similar Topics in the Unix Linux Community |
---|
Rules for Homework & Coursework Questions Forum |
New Code Tags (Syntax Highlighting) |
Please Welcome Don Cragun as Lead Moderator |
Denial Of Service Attack Update |