PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8
preg_replace_callback - Perform a regular expression search and replace using a callback

Example #1 preg_replace_callback example

Result: April fools day is 04/01/2003 Last christmas was 12/24/2002
PHP Version:

Example #2 preg_replace_callback using recursive structure to handle encapsulated BB code

PHP Version:

Example #3 of preg_replace_callback

PHP Version:

Function preg_replace_callback:

Regular Expressions (Perl-Compatible) Functions

Most used PHP functions