preg_filter
PHP 5 >= 5.3.0, PHP 7, PHP 8
preg_filter - Perform a regular expression search and replace
Example #1 Example comparing preg_filter
with preg_replace
Result: preg_filter returns
Array
(
[0] => A:C:1
[1] => B:C:a
[2] => A:2
[3] => B:b
[4] => A:3
[7] => A:4
)
preg_replace returns
Array
(
[0] => A:C:1
[1] => B:C:a
[2] => A:2
[3] => B:b
[4] => A:3
[5] => A
[6] => B
[7] => A:4
)
Example #2 of preg_filter