1--TEST-- 2SPL: RegexIterator::SPLIT, USE_KEY 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'=>0,'1,2'=>1,'1,2,3'=>2,0=>3,'FooBar'=>4,','=>5,',,'=>6)); 19$it = new MyRegexIterator($ar, '/(\d),(\d)/', RegexIterator::SPLIT, RegexIterator::USE_KEY); 20 21$it->show(); 22 23var_dump($ar); 24 25?> 26===DONE=== 27<?php exit(0); ?> 28--EXPECTF-- 29string(3) "1,2" 30array(2) { 31 [0]=> 32 string(0) "" 33 [1]=> 34 string(0) "" 35} 36string(5) "1,2,3" 37array(2) { 38 [0]=> 39 string(0) "" 40 [1]=> 41 string(2) ",3" 42} 43object(ArrayIterator)#%d (1) { 44 ["storage":"ArrayIterator":private]=> 45 array(7) { 46 [1]=> 47 int(0) 48 ["1,2"]=> 49 int(1) 50 ["1,2,3"]=> 51 int(2) 52 [0]=> 53 int(3) 54 ["FooBar"]=> 55 int(4) 56 [","]=> 57 int(5) 58 [",,"]=> 59 int(6) 60 } 61} 62===DONE=== 63