/hphp/test/zend/good/ext/spl/tests/bug66702.php
PHP | 17 lines | 13 code | 1 blank | 3 comment | 0 complexity | 4642e8024ad874bd5dc85cfca1f77007 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
- <?hh
- /**
- * @author Joshua Thijssen <jthijssen+php@noxlogic.nl>
- */
- <<__EntryPoint>> function main(): void {
- $it = new \ArrayIterator(varray["foo", "bar", "baz"]);
- $it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH);
- print_r(iterator_to_array($it2));
- $it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH, \RegexIterator::INVERT_MATCH);
- print_r(iterator_to_array($it2));
- $it = new \ArrayIterator(darray["foo" => 1, "bar" => 2, "baz" => 3]);
- $it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH, \RegexIterator::USE_KEY);
- print_r(iterator_to_array($it2));
- $it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH, \RegexIterator::USE_KEY | \RegexIterator::INVERT_MATCH);
- print_r(iterator_to_array($it2));
- }