AppendIterator::getIteratorIndex
Gets an index of iterators
&reftitle.description;
public intnullAppendIterator::getIteratorIndex
Gets the index of the current inner iterator.
&reftitle.parameters;
&no.function.parameters;
&reftitle.returnvalues;
Returns the zero-based, integer index of the current inner iterator if it exists, or &null; otherwise.
&reftitle.examples;
AppendIterator.getIteratorIndex basic example
'aardwolf', 'b' => 'bear', 'c' => 'capybara'));
$array_b = new ArrayIterator(array('apple', 'orange', 'lemon'));
$iterator = new AppendIterator;
$iterator->append($array_a);
$iterator->append($array_b);
foreach ($iterator as $key => $current) {
echo $iterator->getIteratorIndex() . ' ' . $key . ' ' . $current . PHP_EOL;
}
?>
]]>
&example.outputs;
&reftitle.seealso;
AppendIterator::getInnerIterator
AppendIterator::getArrayIterator