note 105960 added to multipleiterator.attachiterator
| From: | andresdzphp@php.net | Date: | Wed, 28 Sep 2011 06:14:16 +0000 |
| Subject: | note 105960 added to multipleiterator.attachiterator | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183499@lists.php.net to get a copy of this message | ||
<?php
$ait_id = new ArrayIterator(array('c1001', 'c1002', 'c1003'));
$ait_name = new ArrayIterator(array('apple', 'orange', 'banana'));
$ait_units = new ArrayIterator(array(756, 996, 2345));
$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
)
----
Server IP: 190.90.160.68
Probable Submitter: 190.28.2.170 (proxied: 190.28.2.170)
----
Manual Page -- http://www.php.net/manual/en/multipleiterator.attachiterator.php
Edit -- https://master.php.net/note/edit/105960
Del: integrated -- https://master.php.net/note/delete/105960/integrated
Del: useless -- https://master.php.net/note/delete/105960/useless
Del: bad code -- https://master.php.net/note/delete/105960/bad+code
Del: spam -- https://master.php.net/note/delete/105960/spam
Del: non-english -- https://master.php.net/note/delete/105960/non-english
Del: in docs -- https://master.php.net/note/delete/105960/in+docs
Del: other reasons-- https://master.php.net/note/delete/105960
Reject -- https://master.php.net/note/reject/105960
Search -- https://master.php.net/manage/user-notes.php