/hphp/test/zend/good/ext/spl/tests/bug66702.php

http://github.com/facebook/hiphop-php · PHP · 17 lines · 13 code · 1 blank · 3 comment · 0 complexity · 4642e8024ad874bd5dc85cfca1f77007 MD5 · raw file

  1. <?hh
  2. /**
  3. * @author Joshua Thijssen <jthijssen+php@noxlogic.nl>
  4. */
  5. <<__EntryPoint>> function main(): void {
  6. $it = new \ArrayIterator(varray["foo", "bar", "baz"]);
  7. $it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH);
  8. print_r(iterator_to_array($it2));
  9. $it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH, \RegexIterator::INVERT_MATCH);
  10. print_r(iterator_to_array($it2));
  11. $it = new \ArrayIterator(darray["foo" => 1, "bar" => 2, "baz" => 3]);
  12. $it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH, \RegexIterator::USE_KEY);
  13. print_r(iterator_to_array($it2));
  14. $it2 = new \RegexIterator($it, "/^ba/", \RegexIterator::MATCH, \RegexIterator::USE_KEY | \RegexIterator::INVERT_MATCH);
  15. print_r(iterator_to_array($it2));
  16. }