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===DONE=== 29<?php exit(0); ?> 30--EXPECTF-- 31int(1) 32array(3) { 33 [0]=> 34 %s(3) "1,2" 35 [1]=> 36 %s(1) "1" 37 [2]=> 38 %s(1) "2" 39} 40int(2) 41array(3) { 42 [0]=> 43 %s(3) "1,2" 44 [1]=> 45 %s(1) "1" 46 [2]=> 47 %s(1) "2" 48} 49 50Notice: Array to string conversion in %siterator_050.php on line %d 51int(0) 52array(2) { 53 [0]=> 54 %s(1) "1" 55 [1]=> 56 %s(1) "1" 57} 58int(1) 59array(2) { 60 [0]=> 61 %s(1) "1" 62 [1]=> 63 %s(1) "1" 64} 65int(2) 66array(2) { 67 [0]=> 68 %s(1) "1" 69 [1]=> 70 %s(1) "1" 71} 72 73Notice: Array to string conversion in %siterator_050.php on line %d 74object(ArrayIterator)#%d (1) { 75 %s"storage"%s"ArrayIterator":private]=> 76 array(9) { 77 [0]=> 78 %s(1) "1" 79 [1]=> 80 %s(3) "1,2" 81 [2]=> 82 %s(5) "1,2,3" 83 [3]=> 84 %s(0) "" 85 [4]=> 86 NULL 87 [5]=> 88 array(0) { 89 } 90 [6]=> 91 %s(6) "FooBar" 92 [7]=> 93 %s(1) "," 94 [8]=> 95 %s(2) ",," 96 } 97} 98===DONE=== 99