MultipleIterator::attachIterator

(PHP 5 >= 5.3.0)

MultipleIterator::attachIteratorAttaches iterator information

Description

public void MultipleIterator::attachIterator ( Iterator $iterator [, string $infos ] )

Attaches iterator information.

Warning

This function is currently not documented; only its argument list is available.

Parameters

iterator

The new iterator to attach.

infos

The associative information for the Iterator, which must be an integer, a string, or NULL.

Return Values

Description...

Errors/Exceptions

An IllegalValueException if the iterator parameter is invalid, or if infos is already associated information.

See Also

Коментарии

<?php
$ait_id 
= new ArrayIterator(array('c1001''c1002''c1003'));
$ait_name = new ArrayIterator(array('apple''orange''banana'));
$ait_units = new ArrayIterator(array(7569962345));

$mit = new MultipleIterator(MultipleIterator::MIT_KEYS_ASSOC);
$mit->attachIterator($ait_id"ID");
$mit->attachIterator($ait_name"NAME");
$mit->attachIterator($ait_units"UNITS");

echo 
$mit->countIterators() . "\n"//3

if ($mit->containsIterator($ait_id)) { //true
   
echo "ait_id iterator attached \n";
}

foreach (
$mit as $fruit) {
    echo 
"<pre>";
   
print_r($fruit);
    echo 
"</pre>";
}
?>

Result:

3
ait_id iterator attached

Array
(
    [ID] => c1001
    [NAME] => apple
    [UNITS] => 756
)
Array
(
    [ID] => c1002
    [NAME] => orange
    [UNITS] => 996
)
Array
(
    [ID] => c1003
    [NAME] => banana
    [UNITS] => 2345
)
2011-09-28 02:14:16
http://php5.kiev.ua/manual/ru/multipleiterator.attachiterator.html

    Поддержать сайт на родительском проекте КГБ