1--TEST-- 2SPL: RegexIterator::GET_MATCH 3--FILE-- 4<?php 5 6class MyRegexIterator extends RegexIterator 7{ 8 function show() 9 { 10 foreach($this as $k => $v) 11 { 12 var_dump($k); 13 var_dump($v); 14 } 15 } 16} 17 18$ar = new ArrayIterator(array('1','1,2','1,2,3','',NULL,array(),'FooBar',',',',,')); 19$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::GET_MATCH); 20$it->show(); 21 22$it = new MyRegexIterator($ar, '/(\d)/', RegexIterator::GET_MATCH); 23$it->show(); 24 25var_dump($ar); 26 27?> 28--EXPECTF-- 29int(1) 30array(3) { 31 [0]=> 32 %s(3) "1,2" 33 [1]=> 34 %s(1) "1" 35 [2]=> 36 %s(1) "2" 37} 38int(2) 39array(3) { 40 [0]=> 41 %s(3) "1,2" 42 [1]=> 43 %s(1) "1" 44 [2]=> 45 %s(1) "2" 46} 47int(0) 48array(2) { 49 [0]=> 50 %s(1) "1" 51 [1]=> 52 %s(1) "1" 53} 54int(1) 55array(2) { 56 [0]=> 57 %s(1) "1" 58 [1]=> 59 %s(1) "1" 60} 61int(2) 62array(2) { 63 [0]=> 64 %s(1) "1" 65 [1]=> 66 %s(1) "1" 67} 68object(ArrayIterator)#%d (1) { 69 %s"storage"%s"ArrayIterator":private]=> 70 array(9) { 71 [0]=> 72 %s(1) "1" 73 [1]=> 74 %s(3) "1,2" 75 [2]=> 76 %s(5) "1,2,3" 77 [3]=> 78 %s(0) "" 79 [4]=> 80 NULL 81 [5]=> 82 array(0) { 83 } 84 [6]=> 85 %s(6) "FooBar" 86 [7]=> 87 %s(1) "," 88 [8]=> 89 %s(2) ",," 90 } 91} 92