- preg_replace_callback: documentation ( source)
- strtoupper: documentation ( source)
<?php
$string = '$descriptions.language_id = ? AND (x = true OR $xyz.pippo = ?)';
echo preg_replace_callback('#(\$([a-z0-1\._]+))#i', function($matches) {
return strtoupper($matches[1]);
}, $string);