Annotation of embedaddon/php/ext/spl/tests/array_009a.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: SPL: ArrayIterator implementing RecursiveIterator
                      3: --FILE--
                      4: <?php
                      5: 
                      6: class MyRecursiveArrayIterator extends ArrayIterator implements RecursiveIterator
                      7: {
                      8:        function hasChildren()
                      9:        {
                     10:                return is_array($this->current());
                     11:        }
                     12:        
                     13:        function getChildren()
                     14:        {
                     15:                return new MyRecursiveArrayIterator($this->current());
                     16:        }
                     17: }
                     18: 
                     19: $array = array(1, 2 => array(21, 22 => array(221, 222), 23 => array(231)), 3);
                     20: 
                     21: $dir = new RecursiveIteratorIterator(new MyRecursiveArrayIterator($array), RecursiveIteratorIterator::LEAVES_ONLY);
                     22: 
                     23: foreach ($dir as $file) {
                     24:        print "$file\n";
                     25: }
                     26: 
                     27: ?>
                     28: ===DONE===
                     29: <?php exit(0); ?>
                     30: --EXPECT--
                     31: 1
                     32: 21
                     33: 221
                     34: 222
                     35: 231
                     36: 3
                     37: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>