Annotation of embedaddon/php/ext/spl/tests/iterator_050.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: RegexIterator::GET_MATCH
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, '/(\d),(\d)/', RegexIterator::GET_MATCH);
20: $it->show();
21:
22: $it = new MyRegexIterator($ar, '/(\d)/', RegexIterator::GET_MATCH);
23: $it->show();
24:
25: var_dump($ar);
26:
27: ?>
28: ===DONE===
29: <?php exit(0); ?>
30: --EXPECTF--
31: int(1)
32: array(3) {
33: [0]=>
34: %s(3) "1,2"
35: [1]=>
36: %s(1) "1"
37: [2]=>
38: %s(1) "2"
39: }
40: int(2)
41: array(3) {
42: [0]=>
43: %s(3) "1,2"
44: [1]=>
45: %s(1) "1"
46: [2]=>
47: %s(1) "2"
48: }
49: int(0)
50: array(2) {
51: [0]=>
52: %s(1) "1"
53: [1]=>
54: %s(1) "1"
55: }
56: int(1)
57: array(2) {
58: [0]=>
59: %s(1) "1"
60: [1]=>
61: %s(1) "1"
62: }
63: int(2)
64: array(2) {
65: [0]=>
66: %s(1) "1"
67: [1]=>
68: %s(1) "1"
69: }
70: object(ArrayIterator)#%d (1) {
71: %s"storage"%s"ArrayIterator":private]=>
72: array(9) {
73: [0]=>
74: %s(1) "1"
75: [1]=>
76: %s(3) "1,2"
77: [2]=>
78: %s(5) "1,2,3"
79: [3]=>
80: %s(0) ""
81: [4]=>
82: NULL
83: [5]=>
84: array(0) {
85: }
86: [6]=>
87: %s(6) "FooBar"
88: [7]=>
89: %s(1) ","
90: [8]=>
91: %s(2) ",,"
92: }
93: }
94: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>