mirror of
https://github.com/php/php-src.git
synced 2024-12-12 19:33:31 +08:00
9e0e89c5cf
Also rename recursive one.
41 lines
551 B
PHP
Executable File
41 lines
551 B
PHP
Executable File
--TEST--
|
|
SPL: RegexIterator
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("spl")) print "skip"; ?>
|
|
--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/", 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===
|