Annotation of embedaddon/php/ext/spl/tests/iterator_054.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: RegexIterator::SPLIT
3: --FILE--
4: <?php
5:
6: class MyRegexIterator extends RegexIterator
7: {
8: function show()
9: {
10: foreach($this as $k => $v)
11: {
12: var_dump($k);
13: var_dump($v);
14: }
15: }
16: }
17:
18: $ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,'));
19: $it = new MyRegexIterator($ar, '/,/', RegexIterator::SPLIT);
20:
21: $it->show();
22:
23: var_dump($ar);
24:
25: ?>
26: ===DONE===
27: <?php exit(0); ?>
28: --EXPECTF--
29: int(1)
30: array(2) {
31: [0]=>
32: string(1) "1"
33: [1]=>
34: string(1) "2"
35: }
36: int(2)
37: array(3) {
38: [0]=>
39: string(1) "1"
40: [1]=>
41: string(1) "2"
42: [2]=>
43: string(1) "3"
44: }
45: int(7)
46: array(2) {
47: [0]=>
48: string(0) ""
49: [1]=>
50: string(0) ""
51: }
52: int(8)
53: array(3) {
54: [0]=>
55: string(0) ""
56: [1]=>
57: string(0) ""
58: [2]=>
59: string(0) ""
60: }
61: object(ArrayIterator)#%d (1) {
62: ["storage":"ArrayIterator":private]=>
63: array(9) {
64: [0]=>
65: %s(1) "1"
66: [1]=>
67: %s(3) "1,2"
68: [2]=>
69: %s(5) "1,2,3"
70: [3]=>
71: %s(0) ""
72: [4]=>
73: NULL
74: [5]=>
75: array(0) {
76: }
77: [6]=>
78: %s(6) "FooBar"
79: [7]=>
80: %s(1) ","
81: [8]=>
82: %s(2) ",,"
83: }
84: }
85: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>