1--TEST-- 2RegexIterator with $replacement being a reference 3--FILE-- 4<?php 5$a = new ArrayIterator(array('test1', 'test2', 'test3')); 6$i = new RegexIterator($a, '/^(test)(\d+)/', RegexIterator::REPLACE); 7$r = '$2:$1'; 8$i->replacement =& $r; 9var_dump(iterator_to_array($i)); 10?> 11--EXPECT-- 12array(3) { 13 [0]=> 14 string(6) "1:test" 15 [1]=> 16 string(6) "2:test" 17 [2]=> 18 string(6) "3:test" 19} 20