blob: e32262a743f85444155b433729ce59ddee07843e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
--TEST--
Bug #50579 (RegexIterator::REPLACE doesn't work)
--FILE--
<?php
class foo extends ArrayIterator {
public function __construct( ) {
parent::__construct(array(
'test1'=>'test888',
'test2'=>'what?',
'test3'=>'test999'));
}
}
$h = new foo;
$i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE);
$i->replacement = '[$0]';
foreach ($i as $name=>$value) {
echo $name . '=>' . $value . "\n";
}
$i->replacement = '$1';
foreach ($i as $name=>$value) {
echo $name . '=>' . $value . "\n";
}
$h = new foo;
$i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE);
$i->replacement = '[$1]';
foreach ($i as $name=>$value) {
echo $name . '=>' . $value . "\n";
}
?>
--EXPECTF--
test1=>[test888]
test3=>[test999]
test1=>888
test3=>999
test1=>[888]
test3=>[999]
|