blob: a6f79343c70caac642997b6905a4614ed58742fe (
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
|
--TEST--
SPL: RegexIterator
--FILE--
<?php
$ar = array(0, "123", 123, 22 => "abc", "a2b", 22, "a2d" => 7, 42);
foreach(new RegexIterator(new ArrayIterator($ar), "/2/") as $k => $v)
{
echo "$k=>$v\n";
}
?>
===KEY===
<?php
foreach(new RegexIterator(new ArrayIterator($ar), "/2/", 0, RegexIterator::USE_KEY) as $k => $v)
{
echo "$k=>$v\n";
}
?>
--EXPECT--
1=>123
2=>123
23=>a2b
24=>22
25=>42
===KEY===
2=>123
22=>abc
23=>a2b
24=>22
a2d=>7
25=>42
|