yegor256 yegor256 - 2 months ago 13
PHP Question

how to work with RegexIterator::REPLACE mode?

What is wrong in my code:

$i = new RegexIterator(
new ArrayIterator(array(
'test1'=>'test888',
'test2'=>'what?',
'test3'=>'test999')),
'/^test(.*)/',
RegexIterator::REPLACE);

foreach ($i as $name=>$value)
echo $name . '=>' . $value . "\n";


The iterator is empty, why? Thanks for your help!

Answer Source

As said already, it's a bug in PHP. I reported it to php.net: http://bugs.php.net/bug.php?id=50579