I need help to uppercase the text inside double square bracket. for example :
I want to turn below :
hi, [[i]] want [[this]] to be [[uppercase]]
Resulting as below:
hi, [[I]] want [[THIS]] to be [[UPPERCASE]]
When I use below code everything turns everything into uppercase:
$pattern = '/\[\[(.*)\]\]/';
$new_string = preg_replace_callback($pattern,
function($match)
{
return strtoupper($match[0]);
}
, $string);
what is missing in my code?