1--TEST-- 2preg_replace() 3--SKIPIF-- 4<?php 5if (@preg_match('/./u', '') === false) { 6 die('skip no utf8 support in PCRE library'); 7} 8?> 9--FILE-- 10<?php 11 12var_dump(preg_replace(array('/\da(.)/ui', '@..@'), '$1', '12Abc')); 13var_dump(preg_replace(array('/\da(.)/ui', '@(.)@'), '$1', array('x','a2aA', '1av2Ab'))); 14 15 16var_dump(preg_replace(array('/[\w]+/'), array('$'), array('xyz', 'bdbd'))); 17var_dump(preg_replace(array('/\s+/', '~[b-d]~'), array('$'), array('x y', 'bd bc'))); 18 19?> 20--EXPECT-- 21string(1) "c" 22array(3) { 23 [0]=> 24 string(1) "x" 25 [1]=> 26 string(2) "aA" 27 [2]=> 28 string(2) "vb" 29} 30array(2) { 31 [0]=> 32 string(1) "$" 33 [1]=> 34 string(1) "$" 35} 36array(2) { 37 [0]=> 38 string(3) "x$y" 39 [1]=> 40 string(1) "$" 41} 42