note 91122 added to class.arrayiterator
| From: | SeanBurlington at osu1 dot php dot net | Date: | Tue, 26 May 2009 12:15:47 +0000 |
| Subject: | note 91122 added to class.arrayiterator | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-156020@lists.php.net to get a copy of this message | ||
and to iterate recursively use the (sparsely documented) RecursiveArrayIterator
<?php
$fruits = array(
"apple" => "yummy",
"orange" => "ah ya, nice",
"grape" => "wow, I love it!",
"plum" => "nah, not me"
);
$veg = array("potato" => "chips", "carrot" => "soup");
$grocery = array($fruits, $veg);
$obj = new ArrayObject( $grocery );
$it = new RecursiveIteratorIterator( new RecursiveArrayIterator($grocery));
foreach ($it as $key=>$val)
echo $key.":".$val."\n";
?>
Output
--------
apple:yummy
orange:ah ya, nice
grape:wow, I love it!
plum:nah, not me
potato:chips
carrot:soup
----
Server IP: 87.124.35.190
Probable Submitter: 82.111.130.65
----
Manual Page -- http://www.php.net/manual/en/class.arrayiterator.php
Edit -- https://master.php.net/note/edit/91122
Del: integrated -- https://master.php.net/note/delete/91122/integrated
Del: useless -- https://master.php.net/note/delete/91122/useless
Del: bad code -- https://master.php.net/note/delete/91122/bad+code
Del: spam -- https://master.php.net/note/delete/91122/spam
Del: non-english -- https://master.php.net/note/delete/91122/non-english
Del: in docs -- https://master.php.net/note/delete/91122/in+docs
Del: other reasons-- https://master.php.net/note/delete/91122
Reject -- https://master.php.net/note/reject/91122
Search -- https://master.php.net/manage/user-notes.php