Re: Iterators
| From: | Marc Weber | Date: | Tue, 13 Feb 2007 09:36:00 +0000 |
| Subject: | Re: Iterators | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-248796@lists.php.net to get a copy of this message | ||
What did I miss here?In case somebody else wants to know. I've found some examples in php sources ( ext/spl/tests/array_009.phpt ) This is the way to accomplish this: $array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3); $dir = new RecursiveIteratorIterator(new RecursiveArrayIterator($array), RecursiveIteratorIterator::LEAVES_ONLY); foreach ($dir as $file) {
print "$file\n";} Would be really nice to have some hints in documentation. Marc