Annotation of embedaddon/php/ext/spl/tests/iterator_050.phpt, revision 1.1.1.2
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: }
1.1.1.2 ! misho 49:
! 50: Notice: Array to string conversion in %siterator_050.php on line %d
1.1 misho 51: int(0)
52: array(2) {
53: [0]=>
54: %s(1) "1"
55: [1]=>
56: %s(1) "1"
57: }
58: int(1)
59: array(2) {
60: [0]=>
61: %s(1) "1"
62: [1]=>
63: %s(1) "1"
64: }
65: int(2)
66: array(2) {
67: [0]=>
68: %s(1) "1"
69: [1]=>
70: %s(1) "1"
71: }
1.1.1.2 ! misho 72:
! 73: Notice: Array to string conversion in %siterator_050.php on line %d
1.1 misho 74: object(ArrayIterator)#%d (1) {
75: %s"storage"%s"ArrayIterator":private]=>
76: array(9) {
77: [0]=>
78: %s(1) "1"
79: [1]=>
80: %s(3) "1,2"
81: [2]=>
82: %s(5) "1,2,3"
83: [3]=>
84: %s(0) ""
85: [4]=>
86: NULL
87: [5]=>
88: array(0) {
89: }
90: [6]=>
91: %s(6) "FooBar"
92: [7]=>
93: %s(1) ","
94: [8]=>
95: %s(2) ",,"
96: }
97: }
98: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>