1--TEST-- 2SPL: RegexIterator 3--FILE-- 4<?php 5 6$ar = array(0, "123", 123, 22 => "abc", "a2b", 22, "a2d" => 7, 42); 7 8foreach(new RegexIterator(new ArrayIterator($ar), "/2/") as $k => $v) 9{ 10 echo "$k=>$v\n"; 11} 12 13?> 14===KEY=== 15<?php 16 17foreach(new RegexIterator(new ArrayIterator($ar), "/2/", 0, RegexIterator::USE_KEY) as $k => $v) 18{ 19 echo "$k=>$v\n"; 20} 21 22?> 23===DONE=== 24<?php exit(0); ?> 25--EXPECT-- 261=>123 272=>123 2823=>a2b 2924=>22 3025=>42 31===KEY=== 322=>123 3322=>abc 3423=>a2b 3524=>22 36a2d=>7 3725=>42 38===DONE=== 39