php-src/ext/spl/tests/iterator_029.phpt

39 lines
487 B
Plaintext
Raw Normal View History

2005-10-10 23:58:42 +00:00
--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)
2005-10-10 23:58:42 +00:00
{
echo "$k=>$v\n";
}
?>
===KEY===
<?php
foreach(new RegExIterator(new ArrayIterator($ar), "/2/", RegExIterator::USE_KEY) as $k => $v)
2005-10-10 23:58:42 +00:00
{
echo "$k=>$v\n";
}
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
1=>123
2=>123
23=>a2b
24=>22
25=>42
===KEY===
2=>123
22=>abc
2005-10-10 23:58:42 +00:00
23=>a2b
24=>22
a2d=>7
2005-10-10 23:58:42 +00:00
25=>42
===DONE===