xref: /PHP-7.4/ext/pcre/tests/preg_filter.phpt (revision 610c7fbe)
1--TEST--
2preg_filter()
3--FILE--
4<?php
5
6$subject = array('1', 'a', '2', 'b', '3', 'A', 'B', '4');
7$pattern = array('/\d/', '/[a-z]/', '/[1a]/');
8$replace = array('A:$0', 'B:$0', 'C:$0');
9
10var_dump(preg_filter($pattern, $replace, $subject));
11
12?>
13===DONE===
14--EXPECT--
15array(6) {
16  [0]=>
17  string(5) "A:C:1"
18  [1]=>
19  string(5) "B:C:a"
20  [2]=>
21  string(3) "A:2"
22  [3]=>
23  string(3) "B:b"
24  [4]=>
25  string(3) "A:3"
26  [7]=>
27  string(3) "A:4"
28}
29===DONE===
30