Annotation of embedaddon/php/ext/spl/tests/recursiveiteratoriterator_getsubiterator_variation.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: RecursiveIteratorIterator::getSubIterator() returns different iterators depending on the current element
3: --CREDITS--
4: Matt Raines matt@raines.me.uk
5: #testfest London 2009-05-09
6: --FILE--
7: <?php
8: $sample_array = array(1, 2, array(3, 4));
9:
10: $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($sample_array));
11:
12: $iterator->next();
13: $iterator->next();
14: var_dump(get_class($iterator->getSubIterator()));
15: var_dump($iterator->getSubIterator()->getArrayCopy());
16: $iterator->next();
17: var_dump(get_class($iterator->getSubIterator()));
18: var_dump($iterator->getSubIterator()->getArrayCopy());
19: ?>
20: --EXPECTF--
21: %unicode|string%(22) "RecursiveArrayIterator"
22: array(3) {
23: [0]=>
24: int(1)
25: [1]=>
26: int(2)
27: [2]=>
28: array(2) {
29: [0]=>
30: int(3)
31: [1]=>
32: int(4)
33: }
34: }
35: %unicode|string%(22) "RecursiveArrayIterator"
36: array(2) {
37: [0]=>
38: int(3)
39: [1]=>
40: int(4)
41: }
42:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>