blob: ff41dd4931806a83047a7d02e5aecd7932d0ea11 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
--TEST--
Bug #68128 - RecursiveRegexIterator raises "Array to string conversion" notice
--FILE--
<?php
$array = new ArrayIterator(array('a', array('b', 'c')));
$regex = new RegexIterator($array, '/Array/');
foreach ($regex as $match) {
var_dump($match);
}
$rArrayIterator = new RecursiveArrayIterator(array('test1', array('tet3', 'test4', 'test5')));
$rRegexIterator = new RecursiveRegexIterator($rArrayIterator, '/^(t)est(\d*)/',
RecursiveRegexIterator::ALL_MATCHES, 0, PREG_PATTERN_ORDER);
foreach ($rRegexIterator as $key1 => $value1) {
if ($rRegexIterator->hasChildren()) {
// print all children
echo "Children: ";
foreach ($rRegexIterator->getChildren() as $key => $value) {
print_r($value);
}
echo "\n";
} else {
echo "No children ";
print_r($value1);
echo "\n";
}
}
?>
--EXPECT--
No children Array
(
[0] => Array
(
[0] => test1
)
[1] => Array
(
[0] => t
)
[2] => Array
(
[0] => 1
)
)
Children: Array
(
[0] => Array
(
[0] => test4
)
[1] => Array
(
[0] => t
)
[2] => Array
(
[0] => 4
)
)
Array
(
[0] => Array
(
[0] => test5
)
[1] => Array
(
[0] => t
)
[2] => Array
(
[0] => 5
)
)
|