Source Code:
(back to article)
<?php $pattern = '/(\w+)/i'; $string = 'This is a test string'; $new_string = preg_replace_callback( $pattern, function ($matches) { return strtoupper($matches[0]); }, $string ); echo $new_string;
Result:
Report an issue