Annotation of embedaddon/php/ext/pcre/tests/preg_replace2.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: preg_replace()
3: --SKIPIF--
4: <?php
5: if (@preg_match('/./u', '') === false) {
6: die('skip no utf8 support in PCRE library');
7: }
8: ?>
9: --FILE--
10: <?php
11:
12: var_dump(preg_replace('', array(), ''));
13:
14: var_dump(preg_replace(array('/\da(.)/ui', '@..@'), '$1', '12Abc'));
15: var_dump(preg_replace(array('/\da(.)/ui', '@(.)@'), '$1', array('x','a2aA', '1av2Ab')));
16:
17:
18: var_dump(preg_replace(array('/[\w]+/'), array('$'), array('xyz', 'bdbd')));
19: var_dump(preg_replace(array('/\s+/', '~[b-d]~'), array('$'), array('x y', 'bd bc')));
20:
21: echo "==done==\n";
22:
23: ?>
24: --EXPECTF--
25: Warning: preg_replace(): Parameter mismatch, pattern is a string while replacement is an array in %spreg_replace2.php on line 3
26: bool(false)
27: string(1) "c"
28: array(3) {
29: [0]=>
30: string(1) "x"
31: [1]=>
32: string(2) "aA"
33: [2]=>
34: string(2) "vb"
35: }
36: array(2) {
37: [0]=>
38: string(1) "$"
39: [1]=>
40: string(1) "$"
41: }
42: array(2) {
43: [0]=>
44: string(3) "x$y"
45: [1]=>
46: string(1) "$"
47: }
48: ==done==
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>