summaryrefslogtreecommitdiff
path: root/ext/spl/tests/iterator_029.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl/tests/iterator_029.phpt')
-rw-r--r--ext/spl/tests/iterator_029.phpt38
1 files changed, 38 insertions, 0 deletions
diff --git a/ext/spl/tests/iterator_029.phpt b/ext/spl/tests/iterator_029.phpt
new file mode 100644
index 0000000..e5bfde0
--- /dev/null
+++ b/ext/spl/tests/iterator_029.phpt
@@ -0,0 +1,38 @@
+--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";
+}
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECT--
+1=>123
+2=>123
+23=>a2b
+24=>22
+25=>42
+===KEY===
+2=>123
+22=>abc
+23=>a2b
+24=>22
+a2d=>7
+25=>42
+===DONE===