xref: /PHP-8.0/ext/pcre/tests/preg_filter.phpt (revision a555cc0b)
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--EXPECT--
14array(6) {
15  [0]=>
16  string(5) "A:C:1"
17  [1]=>
18  string(5) "B:C:a"
19  [2]=>
20  string(3) "A:2"
21  [3]=>
22  string(3) "B:b"
23  [4]=>
24  string(3) "A:3"
25  [7]=>
26  string(3) "A:4"
27}
28